allow separate theming of page buttons

This commit is contained in:
Jack Baron 2020-02-15 05:25:33 +00:00
parent 26991f4dd4
commit f509f9e64e
No known key found for this signature in database
GPG key ID: CD10BCEEC646C064
4 changed files with 59 additions and 5 deletions

View file

@ -30,28 +30,28 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Button Name="IntroButton" Grid.Row="0" Height="60" Margin="0,0,10,5" Click="IntroButton_Click">
<Button Name="IntroButton" Grid.Row="0" Height="60" Margin="0,0,10,5" Click="IntroButton_Click" Style="{DynamicResource MainPageButton}">
<StackPanel Margin="0,8,0,0">
<Image Height="30" Source="{StaticResource info_circleDrawingImage}" VerticalAlignment="Bottom"></Image>
<TextBlock HorizontalAlignment="Center" Margin="0,0,0,5" VerticalAlignment="Bottom">Intro</TextBlock>
</StackPanel>
</Button>
<Button IsEnabled="false" Name="ModsButton" Grid.Row="1" Height="60" Margin="0,5,10,5" Click="ModsButton_Click">
<Button IsEnabled="false" Name="ModsButton" Grid.Row="1" Height="60" Margin="0,5,10,5" Click="ModsButton_Click" Style="{DynamicResource MainPageButton}">
<StackPanel Margin="0,6,0,0">
<Image Height="30" Source="{StaticResource microchipDrawingImage}" VerticalAlignment="Bottom"></Image>
<TextBlock HorizontalAlignment="Center" Margin="0,0,0,5" VerticalAlignment="Bottom">Mods</TextBlock>
</StackPanel>
</Button>
<Button Name="AboutButton" Grid.Row="2" Height="60" Margin="0,5,10,5" Click="AboutButton_Click">
<Button Name="AboutButton" Grid.Row="2" Height="60" Margin="0,5,10,5" Click="AboutButton_Click" Style="{DynamicResource MainPageButton}">
<StackPanel Margin="0,6,0,0">
<Image Height="30" Source="{StaticResource heartDrawingImage}" VerticalAlignment="Bottom"></Image>
<TextBlock HorizontalAlignment="Center" Margin="0,0,0,5" VerticalAlignment="Bottom">About</TextBlock>
</StackPanel>
</Button>
<Button Name="OptionsButton" Grid.Row="3" Height="60" Margin="0,5,10,5" Click="OptionsButton_Click">
<Button Name="OptionsButton" Grid.Row="3" Height="60" Margin="0,5,10,5" Click="OptionsButton_Click" Style="{DynamicResource MainPageButton}">
<StackPanel Margin="0,5,0,0">
<Image Height="30" Source="{StaticResource cogDrawingImage}" VerticalAlignment="Bottom"></Image>
<TextBlock HorizontalAlignment="Center" Margin="0,0,0,5" VerticalAlignment="Bottom">Options</TextBlock>

View file

@ -1,6 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="Button">
<Style TargetType="Button" x:Key="DefaultButton">
<Setter Property="Background" Value="{DynamicResource ButtonBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBackground}" />
<Setter Property="BorderThickness" Value="1" />
@ -34,6 +34,7 @@
<Setter Property="Background" Value="{DynamicResource ButtonClickedBackground}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource ButtonDisabledText}"/>
<Setter Property="Background" Value="{DynamicResource ButtonDisabledBackground}"/>
</Trigger>
</ControlTemplate.Triggers>
@ -41,4 +42,43 @@
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Button" BasedOn="{StaticResource DefaultButton}" />
<Style TargetType="Button" x:Key="MainPageButton" BasedOn="{StaticResource DefaultButton}">
<Setter Property="Background" Value="{DynamicResource PageButtonBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource PageButtonOutline}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Name="Chrome"
Background="{TemplateBinding Background}"
BorderBrush="{DynamicResource PageButtonOutline}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="true"
TextBlock.Foreground="{DynamicResource TextColor}">
<ContentPresenter Name="Presenter"
Margin="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
TextBlock.Foreground="{DynamicResource TextColor}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="UIElement.IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource PageButtonHighlightedBackground}"/>
<Setter Property="Foreground" Value="{DynamicResource TextHighlighted}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{DynamicResource PageButtonClickedBackground}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{DynamicResource PageButtonDisabledBackground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View file

@ -24,6 +24,13 @@
<SolidColorBrush x:Key="ButtonDisabledBackground" Color="{DynamicResource ResourceKey=StandardSecondary}" />
<SolidColorBrush x:Key="ButtonDangerBackground" Color="#ED172F" />
<!-- Page Buttons (Side of Main Page) -->
<SolidColorBrush x:Key="PageButtonBackground" Color="{DynamicResource ResourceKey=StandardPrimary}" />
<SolidColorBrush x:Key="PageButtonOutline" Color="{DynamicResource ResourceKey=StandardBorder}" />
<SolidColorBrush x:Key="PageButtonHighlightedBackground" Color="{DynamicResource ResourceKey=StandardHighlight}" />
<SolidColorBrush x:Key="PageButtonClickedBackground" Color="{DynamicResource ResourceKey=StandardActive}" />
<SolidColorBrush x:Key="PageButtonDisabledBackground" Color="{DynamicResource ResourceKey=StandardSecondary}" />
<!-- Mod List -->
<SolidColorBrush x:Key="ModColumnBackground" Color="{DynamicResource ResourceKey=StandardPrimary}" />
<SolidColorBrush x:Key="ModColumnBorderBrush" Color="{DynamicResource ResourceKey=StandardBorder}" />

View file

@ -23,6 +23,13 @@
<SolidColorBrush x:Key="ButtonDisabledBackground" Color="{DynamicResource ResourceKey=StandardSecondary}" />
<SolidColorBrush x:Key="ButtonDangerBackground" Color="#ED172F" />
<!-- Page Buttons (Side of Main Page) -->
<SolidColorBrush x:Key="PageButtonBackground" Color="Transparent" />
<SolidColorBrush x:Key="PageButtonOutline" Color="{DynamicResource ResourceKey=StandardBorder}" />
<SolidColorBrush x:Key="PageButtonHighlightedBackground" Color="#20000000" />
<SolidColorBrush x:Key="PageButtonClickedBackground" Color="{DynamicResource ResourceKey=StandardActive}" />
<SolidColorBrush x:Key="PageButtonDisabledBackground" Color="#50000000" />
<!-- Mod List -->
<SolidColorBrush x:Key="ModColumnBackground" Color="{DynamicResource ResourceKey=StandardPrimary}" />
<SolidColorBrush x:Key="ModColumnBorderBrush" Color="{DynamicResource ResourceKey=StandardBorder}" />