Windows Phone ApplicationBarIconButton not displaying icons


So you’ve added an ApplicationBarIconButton to your Windows Phone 7 Silverlight page and you can’t get the icons to display. You’ve tried every path under the sun, pack uri’s, relative uri’s, checked the case everything – still no dice. You’ve put an image control on the page and the image displays fine. So WHY!

Answer: you need to set the image build action to “Content” but it defaults to “Resource”.

<shell:ApplicationBarIconButton
IconUri="/ApplicationBar/light/appbar.delete.rest.png"
Text="delete all"/>

image_2_1F122EE7

I’ve logged this as a bug, but I think its by design. I’m trying to find out why.

Written by Paul Tallett

Comments (14)

  1. AG says:

    Thank you so much for this info, it was driving me nuts.

  2. Muhammad Yusuf says:

    Thank you veeeeery muuuuuuch!!!! I just stucked then you get me the hell out of there. 😀

  3. Dheeraj Kumar says:

    HI ,

    I just want to know if u guys have solved this or not please let me know.

  4. MAB says:

    Thx, saved me a lot of time playing CSI: Microsoft…

  5. andreas says:

    thanks a lot!

  6. ipendle says:

    finally an answer

    Thanks

  7. Kumar says:

    Thanks.

  8. Yikes says:

    Awesome ! Thanks, that saved me hours of frustation !

  9. Sam says:

    Yes thanks…. actually I recently did a tutorial for adding images to the toolkit DatePicker control.. and the guy explicitly said "Don't forget to change the Build Action"… and I forgot.  So it looks like this behavior holds true for all images copied into the project.

  10. Bernhard says:

    I wish I had found this blog post earlier. 😀 However, thank goodness I finally found the mistake!

  11. James says:

    Still a bugs and thank you very much

  12. Robert says:

    This is specific for ApplicationBarIconButton! Other controls can display images that have Resource instead of Content as Build Action.

    the main difference of Content and Resources is, that with Build Action=Resource the images are loaded at assembly load. With Build Action=Content the load is defered until usage.

    So it's a question of performance.

    The URI also is different:

    Resource="/MyApp;component/ResouceFolder/image.png"

    Content="/ResourceFolder/image.png"

  13. Technohuehnchen says:

    "

    The URI also is different:

    Resource="/MyApp;component/ResouceFolder/image.png"

    Content="/ResourceFolder/image.png"

    "

    Big Thanx !!!

  14. Jon says:

    You have saved me from doubting my sanity. Thanks!

    Still can't get that "Resource" style Uri working but I'm fine with the "Content" style setup.

    Oh, thanks again.