locked
how do you get text underneath an appbar button RRS feed

  • Question

  • I've noticed in some sample apps that the appbar buttons have automation properties and id's and use the styles listed in the standard styles xml file. However, the only way I've been able to get the same effect is to put the styled button in a stack panel with a textblock underneath it. Is there a more standard way to do this?

    Michael DiLeo

    Friday, August 23, 2013 9:35 PM

Answers

  • Take a look at the AppBarButtonStyle defined in StandardStyles.xaml to see how it is done there. It's essentially what you describe with stacked TextBlocks, along with extra styling code to modify the button for different view states.

    You can also use the AppBarButtonStyle for your own buttons without having to use the specifically designed ones.

            <Button Style="{StaticResource AppBarButtonStyle}" 
                    AutomationProperties.AutomationId="ClickButton" 
                    AutomationProperties.Name="Click"
                    Click="Button_Click">&#xE14A;</Button>

    --Rob

    Friday, August 23, 2013 10:15 PM
    Moderator