How to convert BitmapImage to System.Windows.Media.Brush ?
I have a BitmapImage, figuratively called bitmap , and I have a Canvas (also figuratively named) canvas .
How to set canvas value to bitmap value?
I tried canvas.Background = bitmap; but this did not work: image.Source = bitmap; works for images but not canvas: and
ImageSourceConverter imgs = new ImageSourceConverter(); canvas.SetValue(Image.SourceProperty, imgs.ConvertFromString(bitmap.ToString()));
didn't work either.
All this worked with images.
Maybe something with bitmap.ToString() will work?
source share