WP7, ApplicationBar, ImageUri and the Icon not showing up

Share and Enjoy:

  • Facebook
  • HackerNews

I know this may sound stupid but when working with the WP7 ApplicationBar make sure the images you are using have the following properties:

Build Action: Content
Build Action: Content
Copy to Output: Copy always (or ‘Copy if newer’, either should work)

I spent a half an hour trying to figure out why my application bar was showing an “X” instead of the image I was putting in IconUri. When first adding images the properties default to:

Build Action: Resource
Copy to Output: Do not copy

Since the application bar is referencing the image by Uri it can’t seem to find it embedded in the application.

My xaml looks like:

<phone:PhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
        <shell:ApplicationBarIconButton
            IconUri="/Images/appbar.feature.settings.rest.png"
            Text="Settings"/>
    </shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
Share and Enjoy:

  • Facebook
  • HackerNews

Comments (4)

OnionsNovember 9th, 2010 at 9:50 am

How can get to this Build Action. Is it the project build properties ? or application bar icon properties. We could not get to this Build Action: Content

BrianNovember 9th, 2010 at 10:18 am

I’ve added a screenshot of the properties window for the image. As you can see it’s the properties on the image itself.

DanJanuary 1st, 2011 at 9:11 pm

I’m glad I’m not the only one who was stumped by this. Thanks for the post. I’m new to coding, but I feel like perhaps this should be the default for images…

JDMarch 26th, 2011 at 8:13 pm

I also have to thank you for this. I’ve been trying to figure out why it wasn’t working and your post pretty much summed everything up. If only I had searched earlier though and I would have saved myself 15 minutes or so…

Leave a comment

Your comment