Luke
Luke

Reputation: 560

Windows 8 XAML AppBar Icon Not Showing

Well, after it initially not working I managed to find the StandardStyles.xaml file which contains things like {StaticResource EditAppBarButtonStyle} that are used all over MSDN in examples. I uncommented the declaration of EditAppBarButtonStyle in StandardStyles.xaml so now the app does not crash but now it just shows up with this:

enter image description here

And the XAML code is:

<Page.BottomAppBar>
    <AppBar x:Name="bottomAppBar" Padding="10,0,10,0" Background="Black">
        <Grid>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                <Button x:Name="Edit" Tag="Edit" Content="{StaticResource EditAppBarButtonStyle}"/>
            </StackPanel>
        </Grid>
    </AppBar>
</Page.BottomAppBar>

After searching all over I can't figure this one out. I didn't even see StandardStyles.xaml mention anywhere, I had to download a sample from MSDN and then go through every file and see what was different. Could anybody tell me why it does not show up with an icon? It is probably a quick thing that I just haven't managed to find.

Also, is this sort of stuff actually mentioned anywhere on MSDN? Thanks

Upvotes: 0

Views: 1125

Answers (1)

N_A
N_A

Reputation: 19897

The problem is that you set the style to the Content property rather than the Style property.

Try:

<Button x:Name="Edit" Tag="Edit" Width="115" Height="70" Style="{StaticResource EditAppBarButtonStyle}"/>

In xaml, if you set an object to display that isn't a visual object, then it will simply print the type of the object, which is why you saw Windows.UI.Xaml.Style since that is the type of a style.

Upvotes: 2

Related Questions