Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InkToolBar: add missing visual states to CustomToggleButton #5447

Merged
merged 1 commit into from
Jul 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 67 additions & 1 deletion dev/CommonStyles/InkToolbar_themeresources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
<StaticResource x:Key="InkToolbarFlyoutItemPressedSelectedBackgroundThemeBrush" ResourceKey="SubtleFillColorSecondaryBrush" />
<StaticResource x:Key="InkToolbarFlyoutItemHoverSelectedBackgroundThemeBrush" ResourceKey="SubtleFillColorSecondaryBrush" />
<StaticResource x:Key="InkToolbarFlyoutItemSelectedBackgroundThemeBrush" ResourceKey="SubtleFillColorSecondaryBrush" />
<StaticResource x:Key="InkToolBarToggleButtonBackgroundChecked" ResourceKey="AccentFillColorDefaultBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonBackgroundCheckedPointerOver" ResourceKey="AccentFillColorSecondaryBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonBackgroundCheckedPressed" ResourceKey="AccentFillColorTertiaryBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonBackgroundCheckedDisabled" ResourceKey="AccentFillColorDisabledBrush"/>
<!--Foreground-->
<StaticResource x:Key="InkToolbarButtonForeground" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="InkToolbarButtonForegroundPointerOver" ResourceKey="TextFillColorPrimaryBrush" />
Expand All @@ -39,6 +43,10 @@
<StaticResource x:Key="InkToolbarFlyoutItemHoverForegroundThemeBrush" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="InkToolbarFlyoutItemPressedForegroundThemeBrush" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="InkToolbarFlyoutItemSelectedForegroundThemeBrush" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="InkToolBarToggleButtonForegroundChecked" ResourceKey="TextOnAccentFillColorPrimaryBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonForegroundCheckedPointerOver" ResourceKey="TextOnAccentFillColorPrimaryBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonForegroundCheckedPressed" ResourceKey="TextOnAccentFillColorSecondaryBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonForegroundCheckedDisabled" ResourceKey="TextOnAccentFillColorDisabledBrush"/>
<!-- BorderBrush -->
<Thickness x:Key="InkToolbarButtonBorderThemeThickness">0</Thickness>
<StaticResource x:Key="InkToolbarButtonBorderBrush" ResourceKey="ControlElevationBorderBrush" />
Expand All @@ -54,6 +62,10 @@
<StaticResource x:Key="InkToolbarFlyoutItemBorderPressedThemeBrush" ResourceKey="InkToolbarFlyoutItemBorderSelectedThemeBrush" />
<StaticResource x:Key="InkToolbarAccentColorForegroundThemeBrush" ResourceKey="AccentTextFillColorPrimaryBrush" />
<StaticResource x:Key="InkToolbarAccentHoverColorForegroundThemeBrush" ResourceKey="AccentTextFillColorSecondaryBrush" />
<StaticResource x:Key="InkToolBarToggleButtonBorderBrushChecked" ResourceKey="SubtleFillColorTransparentBrush" />
<StaticResource x:Key="InkToolBarToggleButtonBorderBrushCheckedPointerOver" ResourceKey="SubtleFillColorTransparentBrush" />
<StaticResource x:Key="InkToolBarToggleButtonBorderBrushCheckedPressed" ResourceKey="SubtleFillColorTransparentBrush" />
<StaticResource x:Key="InkToolBarToggleButtonBorderBrushCheckedDisabled" ResourceKey="SubtleFillColorTransparentBrush" />
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<!--Background-->
Expand All @@ -74,6 +86,10 @@
<StaticResource x:Key="InkToolbarFlyoutItemPressedSelectedBackgroundThemeBrush" ResourceKey="SubtleFillColorSecondaryBrush" />
<StaticResource x:Key="InkToolbarFlyoutItemHoverSelectedBackgroundThemeBrush" ResourceKey="SubtleFillColorSecondaryBrush" />
<StaticResource x:Key="InkToolbarFlyoutItemSelectedBackgroundThemeBrush" ResourceKey="SubtleFillColorSecondaryBrush" />
<StaticResource x:Key="InkToolBarToggleButtonBackgroundChecked" ResourceKey="AccentFillColorDefaultBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonBackgroundCheckedPointerOver" ResourceKey="AccentFillColorSecondaryBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonBackgroundCheckedPressed" ResourceKey="AccentFillColorTertiaryBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonBackgroundCheckedDisabled" ResourceKey="AccentFillColorDisabledBrush"/>
<!--Foreground-->
<StaticResource x:Key="InkToolbarButtonForeground" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="InkToolbarButtonForegroundPointerOver" ResourceKey="TextFillColorPrimaryBrush" />
Expand All @@ -90,6 +106,10 @@
<StaticResource x:Key="InkToolbarFlyoutItemHoverForegroundThemeBrush" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="InkToolbarFlyoutItemPressedForegroundThemeBrush" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="InkToolbarFlyoutItemSelectedForegroundThemeBrush" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="InkToolBarToggleButtonForegroundChecked" ResourceKey="TextOnAccentFillColorPrimaryBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonForegroundCheckedPointerOver" ResourceKey="TextOnAccentFillColorPrimaryBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonForegroundCheckedPressed" ResourceKey="TextOnAccentFillColorSecondaryBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonForegroundCheckedDisabled" ResourceKey="TextOnAccentFillColorDisabledBrush"/>
<!-- BorderBrush -->
<Thickness x:Key="InkToolbarButtonBorderThemeThickness">0</Thickness>
<StaticResource x:Key="InkToolbarButtonBorderBrush" ResourceKey="ControlElevationBorderBrush" />
Expand All @@ -105,6 +125,10 @@
<StaticResource x:Key="InkToolbarFlyoutItemBorderPressedThemeBrush" ResourceKey="InkToolbarFlyoutItemBorderSelectedThemeBrush" />
<StaticResource x:Key="InkToolbarAccentColorForegroundThemeBrush" ResourceKey="AccentTextFillColorPrimaryBrush" />
<StaticResource x:Key="InkToolbarAccentHoverColorForegroundThemeBrush" ResourceKey="AccentTextFillColorSecondaryBrush" />
<StaticResource x:Key="InkToolBarToggleButtonBorderBrushChecked" ResourceKey="SubtleFillColorTransparentBrush" />
<StaticResource x:Key="InkToolBarToggleButtonBorderBrushCheckedPointerOver" ResourceKey="SubtleFillColorTransparentBrush" />
<StaticResource x:Key="InkToolBarToggleButtonBorderBrushCheckedPressed" ResourceKey="SubtleFillColorTransparentBrush" />
<StaticResource x:Key="InkToolBarToggleButtonBorderBrushCheckedDisabled" ResourceKey="SubtleFillColorTransparentBrush" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<SolidColorBrush x:Key="InkToolbarFlyoutItemBackgroundThemeBrush" Color="{ThemeResource SystemColorWindowColor}" />
Expand Down Expand Up @@ -138,6 +162,10 @@
<StaticResource x:Key="InkToolbarButtonSelectedBackgroundPointerOver" ResourceKey="SubtleFillColorSecondaryBrush" />
<StaticResource x:Key="InkToolbarButtonSelectedBackgroundPressed" ResourceKey="SubtleFillColorSecondaryBrush" />
<StaticResource x:Key="InkToolbarButtonSelectedBackgroundDisabled" ResourceKey="ControlFillColorDisabledBrush" />
<StaticResource x:Key="InkToolBarToggleButtonBackgroundChecked" ResourceKey="AccentFillColorDefaultBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonBackgroundCheckedPointerOver" ResourceKey="AccentFillColorSecondaryBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonBackgroundCheckedPressed" ResourceKey="AccentFillColorTertiaryBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonBackgroundCheckedDisabled" ResourceKey="AccentFillColorDisabledBrush"/>
<!-- Foreground -->
<StaticResource x:Key="InkToolbarButtonForeground" ResourceKey="SystemControlForegroundBaseHighBrush" />
<StaticResource x:Key="InkToolbarButtonForegroundPointerOver" ResourceKey="SystemControlHighlightAltBaseHighBrush" />
Expand All @@ -147,6 +175,10 @@
<StaticResource x:Key="InkToolbarButtonSelectedForegroundPointerOver" ResourceKey="SystemControlHighlightAltBaseHighBrush" />
<StaticResource x:Key="InkToolbarButtonSelectedForegroundPressed" ResourceKey="SystemControlHighlightAltBaseHighBrush" />
<StaticResource x:Key="InkToolbarButtonSelectedForegroundDisabled" ResourceKey="SystemControlDisabledBaseMediumLowBrush" />
<StaticResource x:Key="InkToolBarToggleButtonForegroundChecked" ResourceKey="TextOnAccentFillColorPrimaryBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonForegroundCheckedPointerOver" ResourceKey="TextOnAccentFillColorPrimaryBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonForegroundCheckedPressed" ResourceKey="TextOnAccentFillColorSecondaryBrush"/>
<StaticResource x:Key="InkToolBarToggleButtonForegroundCheckedDisabled" ResourceKey="TextOnAccentFillColorDisabledBrush"/>
<!-- BorderBrush -->
<Thickness x:Key="InkToolbarButtonBorderThemeThickness">1</Thickness>
<StaticResource x:Key="InkToolbarButtonBorderBrush" ResourceKey="SystemControlBackgroundTransparentRevealBorderBrush" />
Expand All @@ -157,6 +189,10 @@
<StaticResource x:Key="InkToolbarButtonSelectedBorderBrushPointerOver" ResourceKey="SystemControlTransparentRevealListLowBorderBrush" />
<StaticResource x:Key="InkToolbarButtonSelectedBorderBrushPressed" ResourceKey="SystemControlTransparentRevealListLowBorderBrush" />
<StaticResource x:Key="InkToolbarButtonSelectedBorderBrushDisabled" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="InkToolBarToggleButtonBorderBrushChecked" ResourceKey="SubtleFillColorTransparentBrush" />
<StaticResource x:Key="InkToolBarToggleButtonBorderBrushCheckedPointerOver" ResourceKey="SubtleFillColorTransparentBrush" />
<StaticResource x:Key="InkToolBarToggleButtonBorderBrushCheckedPressed" ResourceKey="SubtleFillColorTransparentBrush" />
<StaticResource x:Key="InkToolBarToggleButtonBorderBrushCheckedDisabled" ResourceKey="SubtleFillColorTransparentBrush" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

Expand Down Expand Up @@ -1776,14 +1812,44 @@
</VisualState.Setters>
</VisualState>

<VisualState x:Name="Checked">
<VisualState.Setters>
<Setter Target="RootElement.Background" Value="{ThemeResource InkToolBarToggleButtonBackgroundChecked}" />
<Setter Target="Border.BorderBrush" Value="{ThemeResource InkToolBarToggleButtonBorderBrushChecked}" />
<Setter Target="Content.Foreground" Value="{ThemeResource InkToolBarToggleButtonForegroundChecked}" />
</VisualState.Setters>
</VisualState>

<VisualState x:Name="CheckedPointerOver">
<VisualState.Setters>
<Setter Target="RootElement.Background" Value="{ThemeResource InkToolBarToggleButtonBackgroundCheckedPointerOver}" />
<Setter Target="Border.BorderBrush" Value="{ThemeResource InkToolBarToggleButtonBorderBrushCheckedPointerOver}" />
<Setter Target="Content.Foreground" Value="{ThemeResource InkToolBarToggleButtonForegroundCheckedPointerOver}" />
</VisualState.Setters>
</VisualState>

<VisualState x:Name="CheckedPressed">
<VisualState.Setters>
<Setter Target="RootElement.Background" Value="{ThemeResource InkToolBarToggleButtonBackgroundCheckedPressed}" />
<Setter Target="Border.BorderBrush" Value="{ThemeResource InkToolBarToggleButtonBorderBrushCheckedPressed}" />
<Setter Target="Content.Foreground" Value="{ThemeResource InkToolBarToggleButtonForegroundCheckedPressed}" />
</VisualState.Setters>
</VisualState>

<VisualState x:Name="CheckedDisabled">
<VisualState.Setters>
<Setter Target="RootElement.Background" Value="{ThemeResource InkToolBarToggleButtonBackgroundCheckedDisabled}" />
<Setter Target="Border.BorderBrush" Value="{ThemeResource InkToolBarToggleButtonBorderBrushCheckedDisabled}" />
<Setter Target="Content.Foreground" Value="{ThemeResource InkToolBarToggleButtonForegroundCheckedDisabled}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>

<VisualStateGroup x:Name="FlowDirectionStates">
<VisualState x:Name="LeftToRight" />
<VisualState x:Name="RightToLeft" />

</VisualStateGroup>

</VisualStateManager.VisualStateGroups>
<Rectangle x:Name="ContentBackground" Fill="Transparent" />
<ContentPresenter x:Name="Content"
Expand Down