2011-10-07 38 views
0

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

我有大约10 RSS项目,什么是包含图像的URL(所有图片为300 * 300像素) 约300图片

我的坏算法是下一个:

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; 

这是很慢和laggy算法,在WPF7中做这件事的正确方法是什么?

回答

1

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

另外,你是否将这些元素加载到列表框?如果是这样,我写了更多lightweight approach here

+0

我喜欢使用virtualizingstackpanel,但我不知道如何从代码中使用virtualizingstackpanel。你能帮我吗? – lacas