Minimizing memory consumption listbox of images (WPF)

拜拜、爱过 提交于 2019-12-05 06:04:10
dutzu

Enable UI Virtualization. Then the UI controls will be recycled and the minimal amount of memory will be used.

You could also load thumbmnails instead of the fully fledged photos.


Some resources to read on:

http://www.codeproject.com/Articles/34405/WPF-Data-Virtualization https://stackoverflow.com/questions/14456075/how-to-enable-ui-virtualization-in-standard-wpf-listview WPF ListBox with a ListBox - UI Virtualization and Scrolling http://www.zagstudio.com/blog/497#.UQKxpScqb6U

Once the image is loaded, resize it to a more managable size then release the unused big image. This will still take a long time to load but it will take less memory. To reduce loading time see dutzu's answer and use lazy loading and virtualization.

Use a Virtualizing Stackpanel Look at the link for an example as to how to do it.

http://www.jonathanantoine.com/2011/10/07/wpf-4-5-%E2%80%93-part-11-new-features-for-the-virtualizingpanel/

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!