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:
Thanks!
I accepted Chris Nicol's answer, but I want to clarify what I did for the record.
Images
.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"
.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.
"First go to Resource View (from menu: View --> Other Window --> Resource View). Then in Resource View navigate through resources, if any. If there is already a resource of Icon type, added by Visual Studio, then open and edit it. Otherwise right-click and select Add Resource, and then add a new icon."
Windows Presentation Foundation (WPF) in Visual Studio provides developers with a unified programming model for building line-of-business desktop applications on Windows.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With