I work in VS 2010, .Net 4.0. In Windows forms app, this is ok:
Image img = Image.FromStream(imagePart.GetStream());
However, in Wpf app, the Image class is from System.Windows.Controls and that isn't valid because it hasn't got a definition for FromStream method. In Windows forms, the Image class is System.Drawing.Image.
Is there a way I can use FromStream in Wpf app?
In WPF I believe you'd use a BitmapSource such as BitmapImage - and in the latter case, you can set the StreamSource property to the appropriate stream.
EDIT: BitmapSource is just one subclass of ImageSource. Use a source by creating an Image control and setting the Source property.
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