I'm looking to use some icons from the VS2008ImageLibrary/Actions/pngformat in my WPF application to get a more Visual Studio look and feel - like the "Insert Standard Items" command in WinForms.
I've added the images as resources, and referenced them in my xaml file:
<DockPanel.Resources>
<Image x:Key="NewIcon" Source="Toolbar Images/NewDocumentHS.png" Height="16" Width="16"/>
</DockPanel.Resources>
And then I've added the image to the Menu and Toolbar
<MenuItem Command="ApplicationCommands.New" Icon="{StaticResource NewIcon}"/>
<!-- ... -->
<Button Command="ApplicationCommands.Save"><StaticResourceExtension ResourceKey="SaveIcon"/></Button>
However, when I open the menu, the icon disappears from the Toolbar, as if the button was never there.I've read elsewhere that this kind of thing occurs due to .NET's lack of support for Vista Icons/Compressed PNGs, but I'm not sure this is exactly the same problem. My attempts to work around this by changing formats have failed, or given sub-optimal results (such as losing transparency). Does anyone know of a better way to do this?
Edit: For other people having this issue, making duplicate entries with different keys in the < DockPanel.Resources > tag for each reference seems to be a functional enough workaround, though I'd be concerned that the images might disappear again if they need to be reloaded for any reason.