c# - Lazy loading images in Virtualized Listbox -
I'm trying to lazy load thumbnail image for each item in a listbox asynchronously. An item display port since the listbox called Greater virtual thumbnail property Only when or in that is near. I really does operation that load thumbail in TriggerLoad event, but the UI is very sensitive, especially not when you try to scroll quickly through the list of items I am waiting for Similar questions have been received but it is not about loading objects in a listbox? Any better approach to lazy loading there is just a part of the data you bound to the listbox. Edit: I tried PriorityBinding and IsAsync option and scroll is not better than my current solution think try to set Warchualaijeshnmod for recycling and a long cash Lalenment set Please.
& lt; Image Source = "{Binding Path = thumbnail target Nilevlugh = {static resource Aisim}}" />
get public BitmapSource thumbnail {TriggerLoad (); Return _ thumbnail; }}
Private async zero TriggerLoad () {if (LoadTriggered) {LoadTriggered = true; Var cacheItem = _cache [key] as CacheItem; If (cacheItem! = Null) await LoadBitmapFromCache (cacheItem); // gives a task and waits for the loaded bitmapfo service (id); // gives a function}}
& lt; ListBox ... VirtualizingPanel.IsContainerVirtualizable = "right" VirtualizingPanel.IsVirtualizing = "right" VirtualizingPanel.VirtualizationMode = "Recycling" VirtualizingPanel.CacheLengthUnit = "page" VirtualizingPanel.CacheLength = "2: So as 2" etc / & gt; "2" 2 "page" (or worthable view-port of the item) means "111" before increasing the CacheLength and after displaying the page in memory Your app will consume more memory than it will be loaded for the user, but users will be able to scroll quickly, before they run in the images being loaded.
Comments
Post a Comment