在Windows Phone 8中的LongListSelector中加载图像的最佳方法

时间:2014-04-10 09:53:05

标签: windows-phone-8 windows-phone

我处境艰难。我想在哪里创建无限滚动图像列表。图像的尺寸为200 x 200。 我正在使用LongListselector图像应该从远程urls加载。所以在LongListselector中加载图像的最佳方法是什么。 下面是LongListSelector Item的xaml。

<Image  Width="190" Height="130"  Source="{Binding Image}"   ImageFailed="Image_ImageFailed"/>

以下是viewmodel

public class RemoteImage{
public ImageSource Image
        {
            get
            {
                this._image = new BitmapImage(new Uri(ItemCommon._baseUri, this._imagePath));                return this._image;
            }

            set
            {
                this._image= value;
                this.SetProperty(ref this._image, value);
            }
        }
}

但是上面的实现给了我Out of Memory Exception。 任何人都可以指导我如何在无限滚动LongListSelector中加载图像,而不会出现内存异常。

谢谢。

1 个答案:

答案 0 :(得分:1)

在用户向下滚动时加载更多项目,并接近列表末尾。 查看this example

相关问题