5
我发现在BitmapImage
上设置RequestCachePolicy
属性对Image
的Source
设置为BitmapImage
的此实例时如何下载位图没有影响。为什么BitmapImage RequestCachePolicy会被忽略?
例如,如果我将RequestCachePolicy
设置为CacheOnly
,我预计不会发生任何互联网流量 - 只应从缓存中检索指定的图像。但是,相反,我看到的请求正在向服务器发出下载一个图像:
source = new BitmapImage(bmi.UriSource,
new RequestCachePolicy(RequestCacheLevel.CacheOnly));
// An image gets downloaded!
如果我的方式我希望设置HttpWebRequest
静态DefaultCachePolicy
属性,那么我的应用程序行为的变化。即当它设置为CacheOnly
时,不会发生网络流量。
为什么上的RequestCachePolicy
属性没有我期望的效果?