I am trying to decode a Tiff image using the code provided in the Microsoft Documentation:
However, when I get to this line:
Image myImage = new Image();
I get an error telling me that I cannot create an instance of an abstract class. I already knew you cannot create an instance of an abstract class, I'm wondering why is this in the documentation?
Here is the whole block of code that is causing problems:
Image myImage = new Image();
myImage.Source = bitmapSource;
myImage.Stretch = Stretch.None;
myImage.Margin = new Thickness(20);
It also says that System.Drawing.Image does not contain a definition for .Source, .Stretch and .Margin which got me thinking I need to use a different namespace? So when I looked up the documentation for Image.Source:
http://msdn.microsoft.com/en-us/library/system.drawing.image(v=vs.110).aspx
It says it uses the System.Windows.Controls namespace which of course is a namespace that contains classes defined in PresentationFramework.dll - which I already have.
Any ideas what I am missing?
System.Windows.Controls.Image myImage = new System.Windows.Controls.Image();