Wednesday, July 3, 2013

How to put Lable below the App Bar Icon

In my last post I have explained how to get some inbuilt Icon in XAML.



Now if you want to display label just below the icon then how can you get them.



Don't use any Stackpanel or anything else. Actually there is a hack on that. You need to use a property "AutomationProperties.Name". Here is the code snippet:

<Page

x:Class="App2.MainPage"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:local="using:App2"

xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

mc:Ignorable="d">

<Page.TopAppBar>

<AppBar>

<StackPanel Orientation="Horizontal">

<Button Style="{StaticResource AppBarButtonStyle}" Content="&#xE10F;" AutomationProperties.Name="Home" />

<Button Style="{StaticResource AppBarButtonStyle}" Content="&#xE082;" AutomationProperties.Name="Bookmark"/>

</StackPanel>

</AppBar>

</Page.TopAppBar>

<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">

</Grid>

</Page>

Happy Coding.

 

No comments:

Post a Comment