Skip to content

Commit

Permalink
Update AppBarButton flyout glyph (#5170)
Browse files Browse the repository at this point in the history
* Update AppBarButton flyout glyph.

* Moved into theme dictionaries
  • Loading branch information
teaP authored Jun 22, 2021
1 parent 574e5ed commit 779c980
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 15 deletions.
13 changes: 10 additions & 3 deletions dev/CommonStyles/AppBarButton_themeresources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<StaticResource x:Key="AppBarButtonSubItemChevronForegroundSubMenuOpened" ResourceKey="TextFillColorSecondaryBrush" />
<StaticResource x:Key="AppBarButtonSubItemChevronForegroundDisabled" ResourceKey="TextFillColorDisabledBrush" />
<Visibility x:Key="AppBarButtonHasFlyoutChevronVisibility">Visible</Visibility>
<x:String x:Key="AppBarButtonFlyoutGlyph">&#xE974;</x:String>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<StaticResource x:Key="AppBarButtonBackground" ResourceKey="SystemControlTransparentBrush" />
Expand Down Expand Up @@ -62,6 +63,7 @@
<StaticResource x:Key="AppBarButtonSubItemChevronForegroundSubMenuOpened" ResourceKey="SystemControlHighlightAltBaseHighBrush" />
<StaticResource x:Key="AppBarButtonSubItemChevronForegroundDisabled" ResourceKey="SystemControlDisabledBaseMediumLowBrush" />
<Visibility x:Key="AppBarButtonHasFlyoutChevronVisibility">Visible</Visibility>
<x:String x:Key="AppBarButtonFlyoutGlyph">&#xE974;</x:String>
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<StaticResource x:Key="AppBarButtonBackground" ResourceKey="SubtleFillColorTransparentBrush" />
Expand Down Expand Up @@ -90,6 +92,7 @@
<StaticResource x:Key="AppBarButtonSubItemChevronForegroundSubMenuOpened" ResourceKey="TextFillColorSecondaryBrush" />
<StaticResource x:Key="AppBarButtonSubItemChevronForegroundDisabled" ResourceKey="TextFillColorDisabledBrush" />
<Visibility x:Key="AppBarButtonHasFlyoutChevronVisibility">Visible</Visibility>
<x:String x:Key="AppBarButtonFlyoutGlyph">&#xE974;</x:String>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

Expand Down Expand Up @@ -174,6 +177,9 @@
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Margin">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarButtonTextLabelOnRightMargin}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SubItemChevron" Storyboard.TargetProperty="Margin">
<DiscreteObjectKeyFrame KeyTime="0" Value="-7,20,12,0" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="LabelCollapsed">
Expand Down Expand Up @@ -413,12 +419,13 @@
AutomationProperties.AccessibilityView="Raw" />
<FontIcon x:Name="SubItemChevron"
Grid.Column="2"
Glyph="&#xE0E3;"
Glyph="{ThemeResource AppBarButtonFlyoutGlyph}"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="12"
FontSize="8"
AutomationProperties.AccessibilityView="Raw"
Foreground="{ThemeResource MenuFlyoutSubItemChevron}"
Margin="12,0,12,0"
VerticalAlignment="Top"
Margin="-23,20,12,0"
MirroredWhenRightToLeft="True"
Visibility="Collapsed"/>

Expand Down
45 changes: 36 additions & 9 deletions dev/CommonStyles/TestUI/CommandBarPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,31 @@
<AppBarButton Icon="Remove" Label="Remove"/>
<AppBarSeparator/>
<AppBarButton Icon="Save" Label="Save"/>
<AppBarToggleButton Icon="Add" Label="Toggle"/>
<AppBarToggleButton Icon="Keyboard" Label="Toggle"/>
<contract7Present:AppBarElementContainer>
<controls:SplitButton>
<Grid Margin="0,1,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<SymbolIcon Symbol="Keyboard" Margin="0,0,8,0"/>
<Viewbox Height="16" Margin="0,0,8,0">
<SymbolIcon Symbol="Keyboard"/>
</Viewbox>
<TextBlock Grid.Column="1" Text="Split"/>
</Grid>
</controls:SplitButton>
</contract7Present:AppBarElementContainer>
<contract7Present:AppBarElementContainer>
<controls:ToggleSplitButton>
<Grid Margin="0,1,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<SymbolIcon Symbol="Shuffle" Margin="0,0,8,0"/>
<Viewbox Height="16" Margin="0,0,8,0">
<SymbolIcon Symbol="Shuffle"/>
</Viewbox>
<TextBlock Grid.Column="1" Text="Toggle"/>
</Grid>
</controls:ToggleSplitButton>
Expand Down Expand Up @@ -167,10 +171,10 @@
<Visibility x:Key="AppBarButtonHasFlyoutChevronVisibility">Visible</Visibility>
</AppBarButton.Resources>
<AppBarButton.Flyout>
<contract7Present:CommandBarFlyout Placement="Right">
<AppBarButton Icon="Play" />
<AppBarButton Icon="People" />
</contract7Present:CommandBarFlyout>
<controls:CommandBarFlyout Placement="Right">
<AppBarButton Icon="Play" />
<AppBarButton Icon="People" />
</controls:CommandBarFlyout>
</AppBarButton.Flyout>
</AppBarButton>
<AppBarButton Icon="Remove" Label="Remove" LabelPosition="Collapsed"/>
Expand All @@ -184,6 +188,29 @@
<AppBarToggleButton Icon="Add" Label="Toggle"/>
</CommandBar.SecondaryCommands>
</CommandBar>

<TextBlock Text="AppBarButton with flyout with visibility override and glyph override"/>
<CommandBar HorizontalAlignment="Left" DefaultLabelPosition="Right">
<CommandBar.Resources>
<x:String x:Key="AppBarButtonFlyoutGlyph">&#xE972;</x:String>
</CommandBar.Resources>
<AppBarButton Icon="Add" Label="Add">
<AppBarButton.Resources>
<Visibility x:Key="AppBarButtonHasFlyoutChevronVisibility">Visible</Visibility>
</AppBarButton.Resources>
<AppBarButton.Flyout>
<MenuFlyout Placement="Bottom">
<MenuFlyoutItem Text="Item 1"/>
<MenuFlyoutItem Text="Item 2"/>
<MenuFlyoutItem Text="Item 3"/>
</MenuFlyout>
</AppBarButton.Flyout>
</AppBarButton>
<AppBarButton Icon="Remove" Label="Remove" LabelPosition="Collapsed"/>
<AppBarSeparator/>
<AppBarButton Icon="Save" Label="Save"/>
<AppBarToggleButton Icon="Add" Label="Toggle"/>
</CommandBar>
</StackPanel>

</Grid>
Expand Down
6 changes: 3 additions & 3 deletions dev/SplitButton/SplitButton_themeresources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<Setter Property="UseSystemFocusVisuals" Value="True" />
<Setter Property="FocusVisualMargin" Value="-3" />
<Setter Property="IsTabStop" Value="True"/>
<Setter Property="Padding" Value="12,7,4,9"/>
<Setter Property="Padding" Value="12,8,4,8"/>
<Setter Property="Height" Value="{ThemeResource AppBarThemeCompactHeight}" />
<contract7Present:Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
<Setter Property="Template">
Expand Down Expand Up @@ -382,9 +382,9 @@
<TextBlock
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="8"
Text="&#xE96E;"
Text="&#xE972;"
VerticalAlignment="Center"
Padding="2,2,2,0"
Padding="2,1,2,0"
HorizontalAlignment="Left"
IsTextScaleFactorEnabled="False"
AutomationProperties.AccessibilityView="Raw"/>
Expand Down

0 comments on commit 779c980

Please sign in to comment.