I’m developing my first Windows Phone 7 application and I have to add an Application Bar with icons.
I referred to this “How To” : http://msdn.microsoft.com/en-us/library/ff431786(VS.92).aspx (“Creating an Application Bar in XAML” paragraph)
But when I run Emulator I cannot see incons: I see the black circle with X in the center and event ApplicationBarIconButton_Click correctly raised.
I’m using icon from WP7AppBarIcons.zip samples and my code is posted below:
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
<shell:ApplicationBarIconButton IconUri="/images/appbar.transport.play.rest.png" Text="Home" Click="ApplicationBarIconButton_Click"/>
<shell:ApplicationBarIconButton IconUri="/images/appbar.favs.rest.png" Text="Preferiti" Click="ApplicationBarIconButton_Click"/>
<shell:ApplicationBarIconButton IconUri="/images/appbar.questionmark.rest.png" Text="About" Click="ApplicationBarIconButton_Click"/>
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text="MenuItem 1"/>
<shell:ApplicationBarMenuItem Text="MenuItem 2"/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
Obviously, I have a root solution folder named “images” containing the mentioned 48 x 48 icons.
Thanks a lot!
Are the images Build Action set to “Content” rather than “Resource” as this is a common mistake – I’ve done it a couple of times myself. They need to be this way as ApplicationBar is not a Silverlight control and the images need to be set to Content.