Skip to content

Commit

Permalink
Fix incorrect margins when active view is not library*
Browse files Browse the repository at this point in the history
  • Loading branch information
darklinkpower committed Sep 12, 2023
1 parent 4df84f9 commit bd9de72
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions source/Views/Library.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
mc:Ignorable="d">

<Style TargetType="{x:Type Library}">
<Setter Property="Tag" Value="Library" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Library}">
Expand Down
26 changes: 24 additions & 2 deletions source/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,30 @@
<ImageBrush ImageSource="{ThemeFile 'Images/BackgroundGradient.png'}" Stretch="UniformToFill" popt:Freeze="True"/>
</Grid.Background>
<Grid>
<ContentControl Name="PART_ContentView"
DockPanel.Dock="Top" />
<Border Tag="{Binding ElementName=PART_ContentView, Path=DataContext.ActiveView.Tag}">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Margin" Value="44,0,0,0" />
<Style.Triggers>
<DataTrigger Binding="{Settings SidebarPosition}" Value="Right">
<Setter Property="Margin" Value="0,0,46,0" />
</DataTrigger>
<DataTrigger Binding="{Settings SidebarPosition}" Value="Top">
<Setter Property="Margin" Value="0,36,0,0" />
</DataTrigger>
<DataTrigger Binding="{Settings SidebarPosition}" Value="Bottom">
<Setter Property="Margin" Value="0,0,0,36" />
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=PART_ContentView, Path=DataContext.ActiveView.Tag, TargetNullValue='', FallbackValue=''}" Value="Library">
<Setter Property="Margin" Value="0" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>

<ContentControl Name="PART_ContentView" />
</Border>

<DockPanel>
<Sidebar x:Name="PART_Sidebar" Panel.ZIndex="999"
DockPanel.Dock="{Settings SidebarPosition}" />
Expand Down

0 comments on commit bd9de72

Please sign in to comment.