What's the recommended way to store images used as icons for a WPF application?
icons, resources, wpf, xaml
Solution
Format - I would say .PNG from experience, though .ICO may suit your needs depending on the source and size of your original graphic.
Storage - They would be resources in the project, most likely created under a folder structure. They can then be accessed through the XAML.
Referencing - It depends on the architecture of your application. In the most basic solution you would have a style that would set the image source property of your toolbar (implementation depends on your control). Each toolbar would implement a style resource.
Hope that helps!
Problem
I am creating a pretty standard business application in WPF. I need to use icons for the toolbars and menu items, and in a few other places. I'd like to know the answers to three (likely interrelated) things: - What format should I use for the images? ICO? PNG? JPG? GIF? - How do I store the images in my VS2008 project? As files on disk? In a RESX file? In a resource dictionary? (If in a resource dictionary, do they then also have to be on disk before the dictionary is "compiled"?) - Once the files are stored appropriately in my project, how best to reference them? Thanks! Update: I accepted Chris Nicol's answer, but I want to clarify what I did for the record. - I created a folder in my project called `Images`. - I put my images into this folder, and made sure that their build action was "Resource". - I created a `ResourceDictionary` XAML file called `Images.xaml`. Inside of this, I created an entry for each file, in the following format: `BitmapImage x:Key="FooIcon" Source="Images\foo.png"`. - I then referenced this `ResourceDictionary` in the usual way as needed. My primary concern was that the resulting images be added to the DLL as resources and that they be accessible through WPF's Resource system.