Lazy loading images in Virtualized Listbox

前端 未结 1 1936
旧巷少年郎
旧巷少年郎 2021-01-03 12:36

I\'m trying to lazy load thumbnail image for each item in a Listbox asynchronously.



        
相关标签:
1条回答
  • 2021-01-03 13:13

    Sounds like although your UI is virtualizing it isn't loading newer images quickly enough to keep up with your user's scrolling. Try setting VirtualizationMode to Recycling and set a longer CacheLength. Like so:

    <ListBox
        VirtualizingPanel.IsContainerVirtualizable="True"
        VirtualizingPanel.IsVirtualizing="True"
        VirtualizingPanel.VirtualizationMode="Recycling"
        VirtualizingPanel.CacheLengthUnit="Page"
        VirtualizingPanel.CacheLength="2,2"
        etc.../>
    

    Increasing CacheLength from "1,1" to "2,2" means two "pages" (or view-ports worth of items) will be loaded into memory before and after the page displayed to the user. Your app will consume that much more memory but users will be able to scroll further, faster, before running into images that aren't loaded.

    0 讨论(0)
提交回复
热议问题