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.
Are your PNGs definitely 2 colour, just white on a transparent background? IIRC they won't load if that's not the case. You might want to grab a PNG from a sample project which does work, just to check whether it's the file contents that are causing the problem or something else.
Also, check the case of "images" - all the samples use "Images" instead of "images"; probably not what's wrong, but worth checking :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With