Browse Source

Update SplitButton in the default theme

pull/7422/head
robloo 5 years ago
parent
commit
cd16f3a89b
  1. 501
      src/Avalonia.Themes.Default/Controls/SplitButton.xaml

501
src/Avalonia.Themes.Default/Controls/SplitButton.xaml

@ -1,6 +1,7 @@
<Styles xmlns="https://github.com/avaloniaui" <Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True"> x:CompileBindings="True"
xmlns:converters="using:Avalonia.Controls.Converters">
<!-- This style is heavily based on the Fluent v1 style. <!-- This style is heavily based on the Fluent v1 style.
The base resources are switched out along with a few minor changes such as Padding, CornerRadius. --> The base resources are switched out along with a few minor changes such as Padding, CornerRadius. -->
@ -12,10 +13,15 @@
</Design.PreviewWith> </Design.PreviewWith>
<Styles.Resources> <Styles.Resources>
<x:Double x:Key="SplitButtonPrimaryButtonSize">32</x:Double> <x:Double x:Key="SplitButtonPrimaryButtonSize">24</x:Double>
<GridLength x:Key="SplitButtonSecondaryButtonSize">32</GridLength> <x:Double x:Key="SplitButtonSecondaryButtonSize">24</x:Double>
<x:Double x:Key="SplitButtonSeparatorWidth">1</x:Double>
<Thickness x:Key="SplitButtonBorderThemeThickness">1</Thickness> <Thickness x:Key="SplitButtonBorderThemeThickness">1</Thickness>
<converters:MarginMultiplierConverter x:Key="PrimaryButtonBorderMultiplier" Left="True" Top="True" Bottom="True" Indent="1" />
<converters:MarginMultiplierConverter x:Key="SecondaryButtonBorderMultiplier" Right="True" Top="True" Bottom="True" Indent="1" />
<converters:MarginMultiplierConverter x:Key="SeparatorBorderMultiplier" Top="True" Bottom="True" Indent="1" />
<StaticResource x:Key="SplitButtonBackground" ResourceKey="ThemeControlMidBrush" /> <StaticResource x:Key="SplitButtonBackground" ResourceKey="ThemeControlMidBrush" />
<StaticResource x:Key="SplitButtonBackgroundPointerOver" ResourceKey="ThemeControlMidBrush" /> <StaticResource x:Key="SplitButtonBackgroundPointerOver" ResourceKey="ThemeControlMidBrush" />
<StaticResource x:Key="SplitButtonBackgroundPressed" ResourceKey="ThemeControlHighBrush" /> <StaticResource x:Key="SplitButtonBackgroundPressed" ResourceKey="ThemeControlHighBrush" />
@ -51,380 +57,211 @@
<Setter Property="BorderThickness" Value="{DynamicResource SplitButtonBorderThemeThickness}" /> <Setter Property="BorderThickness" Value="{DynamicResource SplitButtonBorderThemeThickness}" />
<Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" />
<!--<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" /> <!--<Setter Property="UseSystemFocusVisuals" Value="True" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
<Setter Property="UseSystemFocusVisuals" Value="True" />
<Setter Property="FocusVisualMargin" Value="-3" />--> <Setter Property="FocusVisualMargin" Value="-3" />-->
<Setter Property="KeyboardNavigation.IsTabStop" Value="True" /> <Setter Property="KeyboardNavigation.IsTabStop" Value="True" />
<Setter Property="Focusable" Value="True" />
<Setter Property="Padding" Value="4" /> <Setter Property="Padding" Value="4" />
<Setter Property="CornerRadius" Value="0" /> <Setter Property="CornerRadius" Value="0" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate> <ControlTemplate>
<!-- A Border was added here since Avalonia does not support Background/Border/CornerRadius on Grid directly <Grid>
This also allowed removing the extra background border and integrating it here. --> <Grid.ColumnDefinitions>
<Border x:Name="RootBorder" <ColumnDefinition Width="*" />
Background="Transparent" <ColumnDefinition Width="Auto" />
BorderBrush="{TemplateBinding BorderBrush}" <ColumnDefinition Width="Auto" />
BorderThickness="{TemplateBinding BorderThickness}" </Grid.ColumnDefinitions>
CornerRadius="{TemplateBinding CornerRadius}">
<!-- In WinUI, a separate child style for the inner buttons is provided here.
For avalonia that style is simplified and pulled out separately below.
A style is needed to override any button default background/foreground/border colors, etc. -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"
MinWidth="{StaticResource SplitButtonPrimaryButtonSize}" />
<ColumnDefinition Width="1" />
<ColumnDefinition Width="{StaticResource SplitButtonSecondaryButtonSize}" />
</Grid.ColumnDefinitions>
<!-- Changed from Grid to Border since Avalonia does not support Background/CornerRadius on Grid directly --> <Button x:Name="PART_PrimaryButton"
<Border x:Name="PrimaryBackgroundBorder" Grid.Column="0"
Background="{TemplateBinding Background}" MinWidth="{DynamicResource SplitButtonPrimaryButtonSize}"
CornerRadius="{Binding $parent[SplitButton].CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}" /> Foreground="{TemplateBinding Foreground}"
Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource PrimaryButtonBorderMultiplier}}"
BorderBrush="{TemplateBinding BorderBrush}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Command="{TemplateBinding Command}"
CommandParameter="{TemplateBinding CommandParameter}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Padding="{TemplateBinding Padding}"
Focusable="False"
KeyboardNavigation.IsTabStop="False" />
<Border x:Name="SecondaryBackgroundBorder" <Border x:Name="SeparatorBorder"
Background="{TemplateBinding Background}" Grid.Column="1"
Grid.Column="2" Background="Transparent"
CornerRadius="{Binding $parent[SplitButton].CornerRadius, Converter={StaticResource RightCornerRadiusFilterConverter}}" /> Width="{DynamicResource SplitButtonSeparatorWidth}"
BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource SeparatorBorderMultiplier}}"
BorderBrush="{TemplateBinding BorderBrush}" />
<Button x:Name="PART_PrimaryButton" <Button x:Name="PART_SecondaryButton"
Grid.Column="0" Grid.Column="2"
Foreground="{TemplateBinding Foreground}" MinWidth="{DynamicResource SplitButtonSecondaryButtonSize}"
Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" Foreground="{TemplateBinding Foreground}"
BorderBrush="Transparent" Background="{TemplateBinding Background}"
Content="{TemplateBinding Content}" BorderThickness="{TemplateBinding BorderThickness, Converter={StaticResource SecondaryButtonBorderMultiplier}}"
ContentTemplate="{TemplateBinding ContentTemplate}" Padding="0"
Command="{TemplateBinding Command}" HorizontalContentAlignment="Center"
CommandParameter="{TemplateBinding CommandParameter}" VerticalContentAlignment="Center"
CornerRadius="{Binding $parent[SplitButton].CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}" HorizontalAlignment="Stretch"
FontFamily="{TemplateBinding FontFamily}" VerticalAlignment="Stretch"
FontSize="{TemplateBinding FontSize}" Focusable="False"
FontWeight="{TemplateBinding FontWeight}" KeyboardNavigation.IsTabStop="False" />
HorizontalAlignment="Stretch" </Grid>
VerticalAlignment="Stretch"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Padding="{TemplateBinding Padding}"
KeyboardNavigation.IsTabStop="False" />
<Button x:Name="PART_SecondaryButton"
Grid.Column="2"
CornerRadius="{Binding $parent[SplitButton].CornerRadius, Converter={StaticResource RightCornerRadiusFilterConverter}}"
Foreground="{TemplateBinding Foreground}"
Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="Transparent"
HorizontalContentAlignment="Right"
VerticalContentAlignment="Center"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
KeyboardNavigation.IsTabStop="False"
Padding="0,0,10,0">
<Button.Content>
<!-- TextBlock converted to a Path and placed within Viewbox -->
<Viewbox UseLayoutRounding="False"
IsHitTestVisible="False"
Height="12"
Width="12">
<Path x:Name="DropDownGlyphPath"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Fill="{TemplateBinding Foreground}"
Data="M1939 486L2029 576L1024 1581L19 576L109 486L1024 1401L1939 486Z"
Stretch="Uniform" />
</Viewbox>
</Button.Content>
</Button>
</Grid>
</Border>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<!-- Normal State (not a PseudoClass) --> <!-- Default overridable styles -->
<!-- The 'Button' style here was moved out of the main style above. <Style Selector="SplitButton /template/ Button#PART_PrimaryButton">
In WinUI there is a child, customized style shared for both primary and secondary buttons. <Setter Property="CornerRadius" Value="{TemplateBinding CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}" />
In Avalonia, we can use selectors to make a 'normal' style apply only to those buttons but </Style>
pull it out separately from the full style above. --> <Style Selector="SplitButton /template/ Button#PART_SecondaryButton">
<Style Selector="SplitButton /template/ Button"> <Setter Property="CornerRadius" Value="{TemplateBinding CornerRadius, Converter={StaticResource RightCornerRadiusFilterConverter}}" />
<!-- Applies to both Primary/Secondary buttons --> <Setter Property="Content">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForeground}" /> <Template>
<Setter Property="BorderBrush" Value="Transparent" /> <PathIcon Height="12"
<Setter Property="BorderThickness" Value="{DynamicResource SplitButtonBorderThemeThickness}" /> Width="12"
<Setter Property="Template"> Data="M1939 486L2029 576L1024 1581L19 576L109 486L1024 1401L1939 486Z" />
<ControlTemplate> </Template>
<!-- Switched from Grid to Border to optimize and support Foreground/Background properties -->
<!-- It is important for the background to be clear and no CornerRadius set. -->
<Border Background="Transparent">
<ContentPresenter x:Name="ContentPresenter"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
</ControlTemplate>
</Setter> </Setter>
</Style> </Style>
<!-- Disabled State --> <!-- Primary and Secondary buttons PointerOver State -->
<Style Selector="SplitButton:disabled /template/ Border#RootBorder"> <Style Selector="SplitButton /template/ Button#PART_PrimaryButton:pointerover /template/ ContentPresenter,
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushDisabled}" /> SplitButton /template/ Button#PART_SecondaryButton:pointerover /template/ ContentPresenter">
</Style> <Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundPointerOver}" />
<Style Selector="SplitButton:disabled /template/ Path#DropDownGlyphPath"> <Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPointerOver}" />
<Setter Property="Fill" Value="{DynamicResource SplitButtonForegroundDisabled}" /> <Setter Property="TextBlock.Foreground" Value="{DynamicResource SplitButtonForegroundPointerOver}" />
</Style> </Style>
<Style Selector="SplitButton:disabled /template/ Button"> <Style Selector="SplitButton /template/ Button#PART_SecondaryButton:pointerover PathIcon">
<!-- Applies to both Primary/Secondary buttons --> <Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPointerOver}" />
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundDisabled}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundDisabled}" />
</Style> </Style>
<!-- FlyoutOpen State --> <!-- Primary and Secondary buttons Pressed State -->
<Style Selector="SplitButton:flyout-open /template/ Border#PrimaryBackgroundBorder"> <Style Selector="SplitButton /template/ Button#PART_PrimaryButton:pressed /template/ ContentPresenter,
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundPressed}" /> SplitButton /template/ Button#PART_SecondaryButton:pressed /template/ ContentPresenter">
</Style> <Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundPressed}" />
<Style Selector="SplitButton:flyout-open /template/ Border#SecondaryBackgroundBorder"> <Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPressed}" />
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundPressed}" /> <Setter Property="TextBlock.Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
</Style> </Style>
<Style Selector="SplitButton:flyout-open /template/ Border#RootBorder"> <Style Selector="SplitButton /template/ Button#PART_SecondaryButton:pressed PathIcon">
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPressed}" />
</Style>
<Style Selector="SplitButton:flyout-open /template/ Button#PART_PrimaryButton">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
</Style>
<Style Selector="SplitButton:flyout-open /template/ Button#PART_SecondaryButton">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" /> <Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
</Style> </Style>
<!-- TouchPressed State --> <!-- SplitButton Pressed State -->
<Style Selector="SplitButton:touch-pressed /template/ Border#PrimaryBackgroundBorder"> <Style Selector="SplitButton:pressed /template/ Button#PART_PrimaryButton /template/ ContentPresenter,
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundPressed}" /> SplitButton:pressed /template/ Button#PART_SecondaryButton /template/ ContentPresenter,
</Style> SplitButton:pressed /template/ Border#SeparatorBorder">
<Style Selector="SplitButton:touch-pressed /template/ Border#SecondaryBackgroundBorder"> <Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundPressed}" />
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundPressed}" /> <Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPressed}" />
</Style> <Setter Property="TextBlock.Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
<Style Selector="SplitButton:touch-pressed /template/ Border#RootBorder"> </Style>
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPressed}" /> <Style Selector="SplitButton:pressed /template/ Button#PART_SecondaryButton PathIcon">
</Style>
<Style Selector="SplitButton:touch-pressed /template/ Button#PART_PrimaryButton">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
</Style>
<Style Selector="SplitButton:touch-pressed /template/ Button#PART_SecondaryButton">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" /> <Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
</Style> </Style>
<!-- PrimaryPointerOver State --> <!-- Primary and Secondary buttons Flyout Open State -->
<Style Selector="SplitButton:primary-pointerover /template/ Border#PrimaryBackgroundBorder"> <Style Selector="SplitButton:flyout-open /template/ Button#PART_PrimaryButton /template/ ContentPresenter,
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundPointerOver}" /> SplitButton:flyout-open /template/ Button#PART_SecondaryButton /template/ ContentPresenter,
</Style> SplitButton:flyout-open /template/ Border#SeparatorBorder">
<Style Selector="SplitButton:primary-pointerover /template/ Button#PART_PrimaryButton"> <Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundPressed}" />
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPointerOver}" /> <Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPressed}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPointerOver}" /> <Setter Property="TextBlock.Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
</Style> </Style>
<Style Selector="SplitButton:primary-pointerover /template/ Border#SecondaryBackgroundBorder"> <Style Selector="SplitButton:flyout-open /template/ Button#PART_SecondaryButton PathIcon">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackground}" />
</Style>
<!-- PrimaryPressed State -->
<Style Selector="SplitButton:primary-pressed /template/ Border#PrimaryBackgroundBorder">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundPressed}" />
</Style>
<Style Selector="SplitButton:primary-pressed /template/ Button#PART_PrimaryButton">
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPressed}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" /> <Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
</Style> </Style>
<Style Selector="SplitButton:primary-pressed /template/ Border#SecondaryBackgroundBorder">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackground}" />
</Style>
<!-- SecondaryPointerOver State --> <!-- Disabled State -->
<Style Selector="SplitButton:secondary-pointerover /template/ Border#PrimaryBackgroundBorder"> <Style Selector="SplitButton:disabled /template/ Button#PART_PrimaryButton /template/ ContentPresenter,
<Setter Property="Background" Value="{DynamicResource SplitButtonBackground}" /> SplitButton:disabled /template/ Button#PART_SecondaryButton /template/ ContentPresenter,
</Style> SplitButton:disabled /template/ Border#SeparatorBorder">
<Style Selector="SplitButton:secondary-pointerover /template/ Border#SecondaryBackgroundBorder"> <Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundDisabled}" />
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundPointerOver}" /> <Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushDisabled}" />
</Style> <Setter Property="TextBlock.Foreground" Value="{DynamicResource SplitButtonForegroundDisabled}" />
<Style Selector="SplitButton:secondary-pointerover /template/ Button#PART_SecondaryButton"> </Style>
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPointerOver}" /> <Style Selector="SplitButton:disabled /template/ Button#PART_SecondaryButton PathIcon">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPointerOver}" /> <Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundDisabled}" />
</Style>
<!-- SecondaryPressed State -->
<Style Selector="SplitButton:secondary-pressed /template/ Border#PrimaryBackgroundBorder">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackground}" />
</Style>
<Style Selector="SplitButton:secondary-pressed /template/ Border#SecondaryBackgroundBorder">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundPressed}" />
</Style>
<Style Selector="SplitButton:secondary-pressed /template/ Button#PART_SecondaryButton">
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushPressed}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundPressed}" />
</Style> </Style>
<!-- Checked State --> <!-- Checked State -->
<Style Selector="SplitButton:checked /template/ Border#PrimaryBackgroundBorder"> <Style Selector="SplitButton:checked /template/ Button#PART_PrimaryButton /template/ ContentPresenter,
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundChecked}" /> SplitButton:checked /template/ Button#PART_SecondaryButton /template/ ContentPresenter,
</Style> SplitButton:checked /template/ Border#SeparatorBorder">
<Style Selector="SplitButton:checked /template/ Border#SecondaryBackgroundBorder"> <Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundChecked}" />
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundChecked}" /> <Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushChecked}" />
</Style> <Setter Property="TextBlock.Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" />
<Style Selector="SplitButton:checked /template/ Border#RootBorder"> </Style>
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushChecked}" /> <Style Selector="SplitButton:checked /template/ Button#PART_SecondaryButton PathIcon">
</Style>
<Style Selector="SplitButton:checked /template/ Button#PART_PrimaryButton">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" />
</Style>
<Style Selector="SplitButton:checked /template/ Button#PART_SecondaryButton">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" /> <Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" />
</Style> </Style>
<Style Selector="SplitButton:checked /template/ Path#DropDownGlyphPath">
<Setter Property="Fill" Value="{DynamicResource SplitButtonForegroundChecked}" />
</Style>
<!-- CheckedFlyoutOpen State -->
<Style Selector="SplitButton:checked-flyout-open /template/ Border#PrimaryBackgroundBorder">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundCheckedPressed}" />
</Style>
<Style Selector="SplitButton:checked-flyout-open /template/ Border#SecondaryBackgroundBorder">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundCheckedPressed}" />
</Style>
<Style Selector="SplitButton:checked-flyout-open /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPressed}" />
</Style>
<Style Selector="SplitButton:checked-flyout-open /template/ Button#PART_PrimaryButton">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style>
<Style Selector="SplitButton:checked-flyout-open /template/ Button#PART_SecondaryButton">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style>
<Style Selector="SplitButton:checked-flyout-open /template/ Path#DropDownGlyphPath">
<Setter Property="Fill" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style>
<!-- CheckedTouchPressed State -->
<Style Selector="SplitButton:checked-touch-pressed /template/ Border#PrimaryBackgroundBorder">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundCheckedPressed}" />
</Style>
<Style Selector="SplitButton:checked-touch-pressed /template/ Border#SecondaryBackgroundBorder">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundCheckedPressed}" />
</Style>
<Style Selector="SplitButton:checked-touch-pressed /template/ Border#RootBorder">
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPressed}" />
</Style>
<Style Selector="SplitButton:checked-touch-pressed /template/ Button#PART_PrimaryButton">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style>
<Style Selector="SplitButton:checked-touch-pressed /template/ Button#PART_SecondaryButton">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style>
<Style Selector="SplitButton:checked-touch-pressed /template/ Path#DropDownGlyphPath">
<Setter Property="Fill" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style>
<!-- CheckedPrimaryPointerOver State --> <!-- Checked PointerOver State -->
<Style Selector="SplitButton:checked-primary-pointerover /template/ Border#RootBorder"> <Style Selector="SplitButton:checked /template/ Button#PART_PrimaryButton:pointerover /template/ ContentPresenter,
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushChecked}" /> SplitButton:checked /template/ Button#PART_SecondaryButton:pointerover /template/ ContentPresenter">
</Style> <Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundCheckedPointerOver}" />
<Style Selector="SplitButton:checked-primary-pointerover /template/ Border#PrimaryBackgroundBorder"> <Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPointerOver}" />
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundCheckedPointerOver}" /> <Setter Property="TextBlock.Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPointerOver}" />
</Style> </Style>
<Style Selector="SplitButton:checked-primary-pointerover /template/ Border#SecondaryBackgroundBorder"> <Style Selector="SplitButton:checked /template/ Button#PART_SecondaryButton:pointerover PathIcon">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundChecked}" />
</Style>
<Style Selector="SplitButton:checked-primary-pointerover /template/ Button#PART_PrimaryButton">
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPointerOver}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPointerOver}" /> <Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPointerOver}" />
</Style> </Style>
<Style Selector="SplitButton:checked-primary-pointerover /template/ Button#PART_SecondaryButton">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" />
</Style>
<Style Selector="SplitButton:checked-primary-pointerover /template/ Path#DropDownGlyphPath">
<Setter Property="Fill" Value="{DynamicResource SplitButtonForegroundChecked}" />
</Style>
<!-- CheckedPrimaryPressed State --> <!-- Checked Pressed State -->
<Style Selector="SplitButton:checked-primary-pressed /template/ Border#RootBorder"> <Style Selector="SplitButton:checked /template/ Button#PART_PrimaryButton:pressed /template/ ContentPresenter,
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushChecked}" /> SplitButton:checked /template/ Button#PART_SecondaryButton:pressed /template/ ContentPresenter">
</Style> <Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundCheckedPressed}" />
<Style Selector="SplitButton:checked-primary-pressed /template/ Border#PrimaryBackgroundBorder"> <Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPressed}" />
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundCheckedPressed}" /> <Setter Property="TextBlock.Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style> </Style>
<Style Selector="SplitButton:checked-primary-pressed /template/ Border#SecondaryBackgroundBorder"> <Style Selector="SplitButton:checked /template/ Button#PART_SecondaryButton:pressed PathIcon">
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundChecked}" />
</Style>
<Style Selector="SplitButton:checked-primary-pressed /template/ Button#PART_PrimaryButton">
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPressed}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" /> <Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style> </Style>
<Style Selector="SplitButton:checked-primary-pressed /template/ Button#PART_SecondaryButton">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" />
</Style>
<Style Selector="SplitButton:checked-primary-pressed /template/ Path#DropDownGlyphPath">
<Setter Property="Fill" Value="{DynamicResource SplitButtonForegroundChecked}" />
</Style>
<!-- CheckedSecondaryPointerOver State --> <!-- SplitButton Checked Pressed State -->
<Style Selector="SplitButton:checked-secondary-pointerover /template/ Border#RootBorder"> <Style Selector="SplitButton:pressed:checked /template/ Button#PART_PrimaryButton /template/ ContentPresenter,
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushChecked}" /> SplitButton:pressed:checked /template/ Button#PART_SecondaryButton /template/ ContentPresenter,
</Style> SplitButton:pressed:checked /template/ Border#SeparatorBorder">
<Style Selector="SplitButton:checked-secondary-pointerover /template/ Border#PrimaryBackgroundBorder"> <Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundCheckedPressed}" />
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundChecked}" /> <Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPressed}" />
</Style> <Setter Property="TextBlock.Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
<Style Selector="SplitButton:checked-secondary-pointerover /template/ Border#SecondaryBackgroundBorder"> </Style>
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundCheckedPointerOver}" /> <Style Selector="SplitButton:pressed:checked /template/ Button#PART_SecondaryButton PathIcon">
</Style> <Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
<Style Selector="SplitButton:checked-secondary-pointerover /template/ Button#PART_PrimaryButton">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" />
</Style>
<Style Selector="SplitButton:checked-secondary-pointerover /template/ Button#PART_SecondaryButton">
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPointerOver}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPointerOver}" />
</Style>
<Style Selector="SplitButton:checked-secondary-pointerover /template/ Path#DropDownGlyphPath">
<Setter Property="Fill" Value="{DynamicResource SplitButtonForegroundCheckedPointerOver}" />
</Style> </Style>
<!-- CheckedSecondaryPressed State --> <!-- Checked Flyout Open State -->
<Style Selector="SplitButton:checked-secondary-pressed /template/ Border#RootBorder"> <Style Selector="SplitButton:checked:flyout-open /template/ Button#PART_PrimaryButton /template/ ContentPresenter,
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushChecked}" /> SplitButton:checked:flyout-open /template/ Button#PART_SecondaryButton /template/ ContentPresenter,
</Style> SplitButton:checked:flyout-open /template/ Border#SeparatorBorder">
<Style Selector="SplitButton:checked-secondary-pressed /template/ Border#PrimaryBackgroundBorder"> <Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundCheckedPressed}" />
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundChecked}" /> <Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPressed}" />
</Style> <Setter Property="TextBlock.Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
<Style Selector="SplitButton:checked-secondary-pressed /template/ Border#SecondaryBackgroundBorder"> </Style>
<Setter Property="Background" Value="{DynamicResource SplitButtonBackgroundCheckedPressed}" /> <Style Selector="SplitButton:checked:flyout-open /template/ Button#PART_SecondaryButton PathIcon">
</Style>
<Style Selector="SplitButton:checked-secondary-pressed /template/ Button#PART_PrimaryButton">
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundChecked}" />
</Style>
<Style Selector="SplitButton:checked-secondary-pressed /template/ Button#PART_SecondaryButton">
<Setter Property="BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedPressed}" />
<Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" /> <Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style> </Style>
<Style Selector="SplitButton:checked-secondary-pressed /template/ Path#DropDownGlyphPath">
<Setter Property="Fill" Value="{DynamicResource SplitButtonForegroundCheckedPressed}" />
</Style>
<!-- SecondaryButtonPlacement States --> <!-- Disabled Checked State -->
<!-- Note: Setting Grid attached properties doesn't work here for some unknown reason. <Style Selector="SplitButton:checked:disabled /template/ Button#PART_PrimaryButton /template/ ContentPresenter,
They simply are never changed. In addition, touch-device changes of secondary button SplitButton:checked:disabled /template/ Button#PART_SecondaryButton /template/ ContentPresenter,
size are currently disabled in code-behind. --> SplitButton:checked:disabled /template/ Border#SeparatorBorder">
<Style Selector="SplitButton:secondary-button-right /template/ Button#PART_SecondaryButton"> <Setter Property="Border.Background" Value="{DynamicResource SplitButtonBackgroundCheckedDisabled}" />
<Setter Property="(Grid.Column)" Value="2" /> <Setter Property="Border.BorderBrush" Value="{DynamicResource SplitButtonBorderBrushCheckedDisabled}" />
<Setter Property="(Grid.ColumnSpan)" Value="1" /> <Setter Property="TextBlock.Foreground" Value="{DynamicResource SplitButtonForegroundCheckedDisabled}" />
</Style> </Style>
<Style Selector="SplitButton:secondary-button-span /template/ Button#PART_SecondaryButton"> <Style Selector="SplitButton:checked:disabled /template/ Button#PART_SecondaryButton PathIcon">
<Setter Property="(Grid.Column)" Value="0" /> <Setter Property="Foreground" Value="{DynamicResource SplitButtonForegroundCheckedDisabled}" />
<Setter Property="(Grid.ColumnSpan)" Value="3" />
</Style> </Style>
</Styles> </Styles>

Loading…
Cancel
Save