ItemsControl and Virtualization
i was recently having an issue with an ItemsControl that would take up to 10 seconds to refresh with only 400 records inside it. The structure basically looked like:
<ItemsControl ItemsSource="{Binding Source={StaticResource dataLog}}" ItemTemplate="{StaticResource xamlLogSummaryTemplate}" VirtualizingStackPanel.IsVirtualizing="True">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
So I thought to speed it up, i would change the panel to a VirtualizingStackPanel. Didn't seem to help at all though. After trying several different options, I found that simply replacing the ItemsControl with a ListView made a tremendous difference. Basically, it seems like Virtualization doesn't work with ItemsControl.
<ItemsControl ItemsSource="{Binding Source={StaticResource dataLog}}" ItemTemplate="{StaticResource xamlLogSummaryTemplate}" VirtualizingStackPanel.IsVirtualizing="True">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
So I thought to speed it up, i would change the panel to a VirtualizingStackPanel. Didn't seem to help at all though. After trying several different options, I found that simply replacing the ItemsControl with a ListView made a tremendous difference. Basically, it seems like Virtualization doesn't work with ItemsControl.
Labels: Itemscontrol, VirtualizingStackPanel, WPF
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home