Windows Phone 7将图片添加到列表框的最佳方式?

时间:2011-10-07 13:28:40

标签: windows-phone-7

将图片添加到列表框的最佳方法是什么?

我有大约10个rss项目,包含图片网址(所有图片都是300 * 300px) 大约300张图片

我的BAD算法是下一个:

1, download all xml file, and parse all with XDocument (i have then title and the image url)
2, using a datatemplate with an image and a textblock with Binding
3, lb.ItemsSource=alldatas;

这是一个非常慢且滞后的算法,在WPF7中执行此操作的正确方法是什么?

1 个答案:

答案 0 :(得分:1)

听起来你并没有做任何特别错误的事情。我猜测问题是正在加载300个图像,这导致UI线程被阻止。我建议阅读David Anson's LowProfileImageLoader,这会减少在UI线程上完成的工作量。

另外,您是否将这些元素加载到ListBox中?如果是这样,我写了更多lightweight approach here