39

It is most probably a stupid mistake, but can anyone tell me why my icons are showing in Blend, but not in the simulator (and not in VS10, but that's not really an issue)?

WP7 Application Bar Icons. Blend (left), Simulator (right)

Edit - Here is my XAML :

    <phone:PhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
        <shell:ApplicationBarIconButton IconUri="/Images/share.png" Text="Partager"/>
        <shell:ApplicationBarIconButton IconUri="/Images/appbar.edit.rest.png" Text="Note"/>
        <shell:ApplicationBarIconButton IconUri="/Images/appbar.feature.camera.rest.png" Text="Photos/Vidéos"/>
        <shell:ApplicationBarIconButton IconUri="/Images/calendar.png" Text="Rendez-vous"/>
        <shell:ApplicationBar.MenuItems> 
            <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
            <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
        </shell:ApplicationBar.MenuItems>
    </shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>

My four .png files are 48x48, transparent .png with black foreground, since the appbar.*.rest.png files where like that and found in the Microsoft icons folder

CCovey
  • 803
  • 1
  • 10
  • 17
Thomas Joulin
  • 6,470
  • 8
  • 48
  • 87

2 Answers2

96

Make sure that the image properties 'build to action' is Content.

123 456 789 0
  • 10,240
  • 4
  • 40
  • 68
3

Are your icons:

  • Transparent with a white foreground
  • The right size (48x48)
  • PNGs

? If so, that should be fine. What does your XAML look like?

Jon Skeet
  • 1,261,211
  • 792
  • 8,724
  • 8,929
  • I updated my question, the foreground is black, but otherwise everything is like you said. I found two of these icons in Program Files\Microsoft SDKs\Windows Phone\v7.0\Icons, so I don't think the black foreground is the issue... – Thomas Joulin Nov 24 '10 at 11:51
  • @Thomas: Well, the documentation specifically says that the foreground should be white IIRC, so it's at least worth trying that. – Jon Skeet Nov 24 '10 at 12:11
  • My problem was solved using the build action, but indeed, I should have put a white foreground image then. But when a button is highlighted (clicked), it becomes white and then I would need to change the image, right ? I'm supposed to do that programmatically ? – Thomas Joulin Nov 24 '10 at 13:55
  • @Thomas: No, you don't need to do anything - the system handles things like rotating it etc. – Jon Skeet Nov 24 '10 at 14:04
  • Yep, I so that, and changing the color with the theme. But I mean, when the user's finger taps the button, and hold it there, the background changes to white, and the icon doesn't change colour – Thomas Joulin Nov 24 '10 at 14:13
  • @Thomas: The icon foreground *should* change to black (i.e. it's a white filled in circle with your icon as black on top). That's certainly what happens with my app, and I didn't need to do anything for that to happen. – Jon Skeet Nov 24 '10 at 14:21
  • Well, I created an empty project, uncommented the tabbar code and set a system icon in Blender, and it's not working. You can dl the archive here http://dl.dropbox.com/u/3475545/AppBar.zip or see my solution here : http://db.tt/gSenDVE – Thomas Joulin Nov 24 '10 at 15:04
  • @Thomas: I'll see if I can have a look tonight. – Jon Skeet Nov 24 '10 at 15:49