Virtualization Disabled Due to CanContentScroll is False
Posted: 23 Jun 2022, 07:04
Hey folks, have been experimenting with Virtualization with a somewhat large data set (~350 items) but was running into some issues. Relatively new to Noesis/WPF in general, so would love to see if anyone could point out where I am doing things incorrectly.
XAML:
However, when I intialize this UI screen, I see this line of error in the log:
I have also double checked in the Noesis Inspector and have confirmed all the places that I could set CanContentScroll are indeed all set to True. Not sure if I am missing something obvious or there is some gotcha that I missed where it overwrites/reset CanContentScroll back to False.
Would love some advices on how I could further debug this.
XAML:
Code: Select all
<ListBox x:Name="CardsContainer"
ItemsSource="{Binding viewModel.cards, Mode=OneWay}"
Grid.Row="3"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.VirtualizationMode="Recycling"
ScrollViewer.CanContentScroll="True">
<ListBox.Template>
<ControlTemplate>
<ItemsPresenter ScrollViewer.CanContentScroll="True"/>
</ControlTemplate>
</ListBox.Template>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Vertical"
Margin="5,20,20,20"
VirtualizingPanel.VirtualizationMode="Recycling"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<ContentControl Style="{DynamicResource ContentCardContainer}" Visibility="{Binding Path=CardVisibility, Converter={StaticResource BoolVizConverter}}">
<comp:CardComponent/>
</ContentControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ListBox>When I checked the callstack, I see the log was initiated from VirtualizingStackPanel::CheckVirtualization. And the memory shots up by ~150MB further indicating that Virtualization isn't turned on (each card is almost half a MB and there are ~350 cards).Virtualization disabled: items control CanContentScroll is False
I have also double checked in the Noesis Inspector and have confirmed all the places that I could set CanContentScroll are indeed all set to True. Not sure if I am missing something obvious or there is some gotcha that I missed where it overwrites/reset CanContentScroll back to False.
Would love some advices on how I could further debug this.