Merry Christmas and Happy New Year!
A little How-to put an image from embedded resources into your WPF application. I have found it very useful especially when working with ListView and creating value converters for it.
My solution for this examples looks like that:
1) ImageSource in XAML:
<Image Name="image1"
Source="/ImageSourceExample;component/Assets/flower.jpg" />
Where ImageSourceExample is the assembly name.
2) ImageSource in c#
ImageSourceConverter imgConv = new ImageSourceConverter();
string path = "pack://application:,,/Assets/flower.jpg"
ImageSource imageSource = (ImageSource) imgConv.ConvertFromString(path);
image1.Source = imageSource;
To read more about pack URIs in WPF look here.
Monika
As everyone can see this is my first blog post. I had some problems on startup but now I know all I need and an can start posting. I am very excited to share 'crazy WPF things I do' :-)
Thanks to Joe for giving me the opportunity to blog here and Krzysztof for encouraging me to start blogging.
Hope I won't disappoint those guys,
Monika