Create a resource file with icons and jpgs
-
Friday, April 06, 2012 4:52 PM
Hi!
I will build a C# Class with all the icons and jpgs that i need for all of my WPF Masks etc.
How can I build this class?
And How can i access this class via WPF?
Have anyone a sample or an idea?
Best Regards
Bernd
All Replies
-
Friday, April 06, 2012 5:17 PM
Hi, when you add an image or an icon to your wpf application they will be added by default as a resource. To reference the resource do the following
<Image Source="/WpfApplication1;component/image.jpg" Height="200" Width="200"/>
Above my application is WpfApplication1 image.jpg is located in the root of my project. If you want to use a folder to staore your images you can. They can be referenced the same way:
<Image Source="/WpfApplication1;component/YourFolder/image.jpg" Height="200" Width="200"/>
-
Friday, April 06, 2012 5:21 PM
Hi Bernd,
Check below link for Image Load / Save from resource
http://technicalreflections.wordpress.com/2011/12/06/wpf-loading-an-image-from-a-resource-file/
http://www.java2s.com/Code/CSharp/Development-Class/Saveandloadimagefromresourcefile.htm
Regards
- Proposed As Answer by Joba DinizMicrosoft Community Contributor Tuesday, April 10, 2012 2:21 PM
-
Friday, April 06, 2012 5:23 PM
But when I will have all the picture in a c# class?
Then i can make easy a change of a jpg or an icon in a c# class.
And i must not copy all of my picture and icons to my customers...
-
Saturday, April 07, 2012 4:22 AM
What I mean is a resource file that have all icons etc. intern in a library.
Under windows there is a resource file a windows dll with a lot of picture and you can pic up
one of the picture and show the picture e.g. on a button or on a widow etc.
Best Regards
Bernd

