The Source property does not "want" a string, it just converts it when it gets one. If you add an icon to the resources it will be of the type System.Drawing. Icon You will need to convert it to an ImageSource via converter.
The Source property does not "want" a string, it just converts it when it gets one. If you add an icon to the resources it will be of the type System.Drawing.Icon. You will need to convert it to an ImageSource via converter.
You can do a static access to resources but it needs to comply with the expected syntax of x:Static. E.g. Xmlns:prop="clr-namespace:Test.
Properties" public class IconToImageSourceConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization. CultureInfo culture) { var icon = value as System.Drawing. Icon; var bitmap = icon.ToBitmap(); //http://stackoverflow.com/questions/94456/load-a-wpf-bitmapimage-from-a-system-drawing-bitmap/1069509#1069509 MemoryStream ms = new MemoryStream(); bitmap.
Save(ms, System.Drawing.Imaging.ImageFormat. Png); ms. Position = 0; BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.
StreamSource = ms; bi.EndInit(); return bi; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization. CultureInfo culture) { throw new NotSupportedException(); } } Notes: The resource access modifier must be public If the image is added as "Image" you end up with a Bitmap instead of an Icon, which requires a different converter.
Very useful... I think. I'm now getting an error that says: Unknown build error, 'Key cannot be null. Parameter name: key Line 131 Position 34.' Pointing to Binding Source="{x:Static res:AppResources.
Minimize}" – Swooper Apr 26 at 14:05 Hmm, what key I wonder, I did not encounter such problems... – H.B. Apr 26 at 14:06 One thing that is important is that the resource access modifier is public as opposed to internal, but that throws another exception that the one you have. – H.B. Apr 26 at 14:16 I'm using . NET 3.5 rather than 4.0 for backwards compatibility reasons - I don't suppose that could be an issue here?
– Swooper Apr 26 at 14:19 Nope, I just went ahead and tested it in a new . NET 3.5 project, it worked. – H.B.Apr 26 at 14:25.
Aaah, I actually ran into exactly that article while googling around for a solution. Thanks, but it didn't really help me. – Swooper Apr 26 at 13:03.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.