Skip to content

Commit

Permalink
TopPanel: Add support for ThemeExtras navigation buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
darklinkpower committed Mar 14, 2024
1 parent a84a1b6 commit 1cdbd82
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/Constants.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<sys:Int32 x:Key="GridViewSectionOrderGameRelations">11</sys:Int32>
<sys:Boolean x:Key="GridViewCoverZoomOnHover">True</sys:Boolean>
<sys:Boolean x:Key="SidebarUseTransparentBackground">False</sys:Boolean>
<sys:Boolean x:Key="ShowNavigationButtons">True</sys:Boolean>
<!--region end-->

<sys:Double x:Key="PanelTopPanelSeparatorHeight">65</sys:Double>
Expand Down
59 changes: 59 additions & 0 deletions source/CustomControls/TopPanelItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,63 @@
</MultiTrigger>
</Style.Triggers>
</Style>

<Style TargetType="{x:Type Button}" x:Key="TopPanelNavigateBackButtonStyle">
<Setter Property="MinWidth" Value="35" />
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
<Setter Property="Margin" Value="8,0,0,0" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="3" />
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="Border" BorderThickness="0" Background="{TemplateBinding Background}"
CornerRadius="{DynamicResource ControlCornerRadius}" BorderBrush="{TemplateBinding BorderBrush}">
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xE72B;"
FontSize="16"
x:Name="Icon"
Foreground="{TemplateBinding Foreground}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.50" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsEnabled" Value="True" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<Setter Property="Foreground" Value="{DynamicResource TopPanelItemMouseOverForegroundBrush}" />
</MultiTrigger>
</Style.Triggers>
</Style>

<Style x:Key="TopPanelNavigateForwardButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource TopPanelNavigateBackButtonStyle}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="Border" BorderThickness="0" Background="{TemplateBinding Background}"
CornerRadius="{DynamicResource ControlCornerRadius}" BorderBrush="{TemplateBinding BorderBrush}">
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xE72A;"
FontSize="16"
Foreground="{TemplateBinding Foreground}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
12 changes: 12 additions & 0 deletions source/Views/TopPanel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,18 @@
<Image Source="{ThemeFile 'Images/applogo.png'}"
RenderOptions.BitmapScalingMode="Fant"/>
</Border>

<Border Tag="{DynamicResource ShowNavigationButtons}"
DockPanel.Dock="Left"
Visibility="{Binding Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource BooleanToVisibilityConverter}}">
<StackPanel Visibility="{PluginStatus Plugin=felixkmh_Extras_Plugin}"
Margin="{Binding ElementName=PART_ToggleNotifications, Path=Margin}"
Orientation="Horizontal">
<Button Style="{DynamicResource TopPanelNavigateBackButtonStyle}" Command="{PluginSettings Plugin=ThemeExtras, Path=Commands.BackCommand, FallbackValue={x:Null}}" />
<Button Style="{DynamicResource TopPanelNavigateForwardButtonStyle}" Command="{PluginSettings Plugin=ThemeExtras, Path=Commands.ForwardCommand, FallbackValue={x:Null}}" />
</StackPanel>
</Border>

<DockPanel LastChildFill="True" DockPanel.Dock="Left"
HorizontalAlignment="Center" Margin="0,5,0,5">
<Button Name="PART_ButtonProgressCancel" DockPanel.Dock="Right"
Expand Down
2 changes: 2 additions & 0 deletions source/thememodifier.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Constants:
- "Top Panel"
- ShowNavigationButtons: 'Show navigation buttons'
- "Sidebar"
- SidebarUseTransparentBackground: 'Use transparent background'
- "Library"
Expand Down

0 comments on commit 1cdbd82

Please sign in to comment.