简体   繁体   中英

Serializing BitmapImage in WPF

I'm trying to serialize a custom class, however I get a error 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.

一种方法是将ImageSource传递给WriteableBitmap的构造函数,然后使用WriteableBitmap的Pixels属性获取像素数据。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM