Silverlight 3引入了元素上的CacheMode
参数。目前唯一支持的格式是BitmapCache
。在XAML中,可以将此值设置为以下内容:
<Image CacheMode="BitmapCache" Source="MyImage.png"></Image>
我希望在运行时做相同的事情,但迄今为止一直失败,以下两个示例都不起作用。
Image image;
image.CacheMode = ?? // Could not find any enum to set it to
image.CacheMode.SetValue(CacheModeProperty, "BitmapCache"); // Does not work
我正在寻求有人能够提供代码或解决方法来动态创建元素(例如Image
),并将其CacheMode
设置为BitmapCache
。