我要做的是用预加载的图像动态填充 Windows 8 Metro 应用程序中的 ListView。
对于每个项目(URI),我用这样的代码(C++)做的很简单:
Windows::UI::Xaml::Media::Imaging::BitmapImage^ bitmapSrc =
ref new Windows::UI::Xaml::Media::Imaging::BitmapImage();
bitmapSrc->CreateOptions = Windows::UI::Xaml::Media::Imaging::BitmapCreateOptions::IgnoreImageCache;
bitmapSrc->UriSource = uri;
img->Source = bitmapSrc;
LoadListView->Items->Append(img);
但是当我删除(在应用程序中)由 URI 描述的源图像并创建具有相同名称的新文件并尝试将其重新加载到列表中时,我失败了,并且显示的图像是旧的(已删除)。我认为这里有一些缓存工作。我试图避免通过 CreateOptions 中的 IgnoreImageCache 值进行缓存,但它不起作用。
任何线索如何在 Windows 8 应用程序中禁用可能绑定到 ListView 的 BitmapSource (Image) 缓存?
我尝试了几个受 Silverlight 和 WPF 启发的方向,但不幸的是没有一个有效。