【发布时间】:2010-09-16 08:48:34
【问题描述】:
假设我在数据库中有应用程序菜单及其图标图像(二进制数据)。我提取那些图标为 byte[] 类型的菜单。但是,如果没有设置图标,那么我想使用默认图标,它不是来自数据库,而是来自 xap(在 Resources 文件夹内)。为了显示来自数据库的图标,我使用 IConverter (byte[] to image),它基于以下问题的代码:
Silverlight 4.0: How to convert byte[] to image?
为了能够使用我的 byte[]-to-image IConverter,我还想将我的默认图标转换为来自 xap 的 byte[]。我怎么能这样做?以下问题建议使用 WriteableBitmap 类,但我不知道如何从 xap 源创建 WriteableBitMap:
【问题讨论】:
标签: silverlight image bytearray