Skip to content

Commit

Permalink
Fixed an issue that caused the locations panel fill orientation to no…
Browse files Browse the repository at this point in the history
…t change with the layout in some cases.
  • Loading branch information
trippsc2 committed May 13, 2020
1 parent 53bf3d2 commit 18feb96
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions OpenTracker/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@
[assembly: SuppressMessage("Naming", "CA1710:Identifiers should have correct suffix", Justification = "ObservableDictionary is a dictionary-type class.", Scope = "type", Target = "~T:OpenTracker.Utils.ObservableDictionary`2")]
[assembly: SuppressMessage("Usage", "CA2211:Non-constant fields should not be visible", Justification = "Necessary use of static public field.", Scope = "member", Target = "~F:OpenTracker.App.Selector")]
[assembly: SuppressMessage("Usage", "CA2211:Non-constant fields should not be visible", Justification = "AvaloniaProperty must be public fields for binding.", Scope = "member", Target = "~F:OpenTracker.Views.MainWindow.SelectorProperty")]
[assembly: SuppressMessage("Usage", "CA2211:Non-constant fields should not be visible", Justification = "AvaloniaProperty must be public fields for binding.", Scope = "member", Target = "~F:OpenTracker.Views.MainWindow.LocationsPanelOrientationProperty")]
2 changes: 1 addition & 1 deletion OpenTracker/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="{Binding RelativeSource={RelativeSource AncestorType=view:MainWindow},
Path=MapPanelOrientation, Mode=OneWay}" />
Path=LocationsPanelOrientation, Mode=OneWay}" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>

Expand Down
12 changes: 12 additions & 0 deletions OpenTracker/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ public bool ModeSettingsPopupOpen
set => SetValue(ModeSettingsPopupOpenProperty, value);
}

public static AvaloniaProperty<Orientation> LocationsPanelOrientationProperty =
AvaloniaProperty.Register<MainWindow, Orientation>(nameof(LocationsPanelOrientation));
public Orientation LocationsPanelOrientation
{
get => GetValue(LocationsPanelOrientationProperty);
set => SetValue(LocationsPanelOrientationProperty, value);
}

public static AvaloniaProperty<string> CurrentFilePathProperty =
AvaloniaProperty.Register<MainWindow, string>(nameof(CurrentFilePath));
public string CurrentFilePath
Expand Down Expand Up @@ -195,6 +203,8 @@ private void ChangeLayout(Rect bounds)

private void HorizontalLayout()
{
LocationsPanelOrientation = Orientation.Horizontal;

if (ViewModel.HorizontalUIPanelPlacement == Models.Enums.VerticalAlignment.Top)
UIPanelDock = Dock.Top;
else
Expand Down Expand Up @@ -231,6 +241,8 @@ private void HorizontalLayout()

private void VerticalLayout()
{
LocationsPanelOrientation = Orientation.Vertical;

if (ViewModel.VerticalUIPanelPlacement == Models.Enums.HorizontalAlignment.Left)
UIPanelDock = Dock.Left;
else
Expand Down

0 comments on commit 18feb96

Please sign in to comment.