Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
AppBarButton exceptions in Windows 8.1
<Page x:Class="BlankApp1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Page.Resources>
<!-- this works -->
<Style x:Key="Style1" TargetType="AppBarButton">
<Setter Property="Icon" Value="Previous" />
</Style>
<!-- these throw exception -->
<Style x:Key="Style2" TargetType="AppBarButton">
<Setter Property="Icon">
<Setter.Value>
<SymbolIcon Symbol="Previous" />
</Setter.Value>
</Setter>
</Style>
<Style x:Key="Style3" TargetType="AppBarButton">
<Setter Property="Icon">
<Setter.Value>
<FontIcon Glyph="&#x1F4BF;"/>
</Setter.Value>
</Setter>
</Style>
</Page.Resources>
<Page.BottomAppBar>
<CommandBar x:Name="Bar" IsOpen="True">
<CommandBar.PrimaryCommands>
<AppBarButton Style="{StaticResource Style1}" Label="Style1"/>
<AppBarButton Style="{StaticResource Style2}" Label="Style2"/>
<AppBarButton Style="{StaticResource Style3}" Label="Style3"/>
</CommandBar.PrimaryCommands>
<CommandBar.SecondaryCommands>
<AppBarButton Icon="Previous" Label="NoStyle1"/>
<AppBarButton Label="NoStyle2">
<AppBarButton.Icon>
<SymbolIcon Symbol="Previous" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Label="NoStyle3">
<AppBarButton.Icon>
<FontIcon Glyph="&#x1F4BF;" />
</AppBarButton.Icon>
</AppBarButton>
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
</Page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment