我试图在 Windows Phone 8 的 ListBox 中加载 BitmapImages 并看到奇怪的行为。第一次显示页面时,ListBox 显示为空,但如果我返回,则返回图像加载的页面。对我来说,似乎没有在需要时加载图像。这是我正在使用的代码(通过转换器):
BitmapImage img = null;
StreamResourceInfo res = Application.GetResourceStream(new Uri("/MyAssembly;component/Resource/images/myimage.png", UriKind.Relative));
Stream s = res.Stream;
using (s) {
img= new BitmapImage();
img.SetSource(s);
}
img.CreateOptions = BitmapCreateOptions.None;
我试过尝试创建选项无济于事。