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
BitmapSourcesuch asBitmapImage– and in the latter case, you can set theStreamSourceproperty to the appropriate stream.EDIT:
BitmapSourceis just one subclass ofImageSource. Use a source by creating anImagecontrol and setting theSourceproperty.