我想在窗口手机7中使用Dipose缓存.在我的项目中,我有下载图像,使用后我通过以下方式处理图像:
Image.source = null;
Image = null;
Run Code Online (Sandbox Code Playgroud)
但内存不会恢复原状,例如:
下载后我设置了图像源:
img.source = new bitmapImage(new uri("http://diadiem.com/image/123.jpg"),UriKind.Relative);
Run Code Online (Sandbox Code Playgroud)
当下一页或LoadPage再次:我想要清除项目旧项目,并在缓存中补充内存.虽然我尝试了设置image.source= null
,并设置控制Image = null
.但记忆不会恢复原状.
请帮我!
要从缓存中删除下载的图像,您需要将其源分配给单独的,BitmapImage
并在将图像的源设置为null之前将其设置为null.
BitmapImage bitmapImage = image.Source as BitmapImage;
bitmapImage.UriSource = null;
image.Source = null;
Run Code Online (Sandbox Code Playgroud)
不要问我为什么,但它有效.
归档时间: |
|
查看次数: |
3116 次 |
最近记录: |