我正在尝试使用 WriteableBitmapEx 从硬盘驱动器上的图像创建 WriteableBitmap。添加nuget包后,我从官方页面复制了代码:
WriteableBitmap writeableBmp = new WriteableBitmap(0, 0).FromResource("Data/flower2.png");
但我得到了错误
'System.Windows.Media.Imaging.WriteableBitmap' 不包含采用 2 个参数的构造函数
我已经添加了 PresentationCore.dll,正如我在控制台应用程序中的 WriteableBitmapEx 被告知的那样? 以及 System.Windows.Media.Imaging 的 using 语句。