开发者

Serializing BitmapImage in WPF

I'm trying to serialize a custom class, however I get a erro开发者_运维问答r saying System.Windows.Media.Imaging.BitmapImage is not marked as serializable. I understand that I will need to convert it a byte array or something in order to serialize it, but I'm not sure how to approach this.

I've found this question: Serializing a WPF Image but don't know how to adapt it for my use. Could someone point me in the right direction and possibly link some material to read up on when dealing with serialization in WPF.


A way is to pass the ImageSource to the constructor of the WriteableBitmap and then use the Pixels property of the WriteableBitmap to get to the pixel data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜