Reputation: 4297
I'm trying to create a WriteableBitmap from an Image on my hard drive using WriteableBitmapEx. I copied the code from the official page after adding the nuget package:
WriteableBitmap writeableBmp = new WriteableBitmap(0, 0).FromResource("Data/flower2.png");
but I get the error
'System.Windows.Media.Imaging.WriteableBitmap' does not contain a constructor that takes 2 arguments
I have added the PresentationCore.dll as I was told here WriteableBitmapEx in console application? and also a using statement for System.Windows.Media.Imaging.
Upvotes: 0
Views: 1892
Reputation: 15981
The WriteableBitmapEx library provides a generic factory method for constructing writeable bitmaps, namely BitmapFactory.New
. Use this portable method instead to generate your dummy writeable bitmap:
WriteableBitmap writeableBmp = BitmapFactory.New(0, 0).FromResource("Data/flower2.png");
The BitmapFactory
class is in the System.Windows.Media.Imaging
namespace (unless you are using the WinRT version of WriteableBitmapEx, where it is in the Windows.UI.Xaml.Media.Imaging
namespace).
Upvotes: 5