w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to Check if ListBox Bound to ObservableCollection is Virtualized

You are NOT virtualizing. When you set the ItemsPanel of the ListBox, you remove the ability to virtualize.

<ListBox x:Name="Recent" Margin="8"
                 SelectionChanged="recent_SelectionChanged"
toolkit:TiltEffect.IsTiltEnabled="True"
                 ItemContainerStyle="{StaticResource MyStyle}">
    <ListBox.ItemsPanel> <!-- This is removing
virtualization-->
         <ItemsPanelTemplate>
            <toolkit:WrapPanel Orientation="Horizontal" />
         </ItemsPanelTemplate>
    </ListBox.ItemsPanel>
</ListBox>

You can test this by removing the ItemsPanel customization and adding 1000 items. Scroll the listbox and look at the load time of the control. Add the customization back in and you'll notice decreased performance and increased load time.

That said, you may want to see how some of the WPF virtualizing wrap panels work on WP8. I tried them in a WPF project I did previously and didn't have as much luck as I would have liked, but your results may vary.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.