3

I have a list view with a ton of data and any time I go to scroll / click somewhere on the screen it always takes a few seconds to react. I tried setting the list view to use virtualization but can't seem to get it to work.

I have tried this and this. Not sure if I am doing something wrong or not understanding how the virtualization works?

I do have a lot of styling / added grid view behaviors for my listview. If you have any suggestions please let me know!

What I Have Tried

  • I have tried removing the CollapseableCollumnBehavior from the list view. Had no change.
  • Removed all my font styles. Had no change.
  • Reduced the number of columns. Had a small change but still very unresponsive.
  • Turned off IsSyncronizedWithCurrentItem. Had no change.

Item Source

My item source is just an observable collection.This is how I load data into it.

private void LoadAllData()
{
    using (var uow = _unitOfWorkFactory.Create())
    {
        foreach (var rule in _ruleRepository.GetAllRulesInCheckProcess())
        {
            AllRulesInCheckProcess.Add(rule);
        }
    }
}

XAML:

I took out a lot of my styling and added column behaviors from the xaml to simplify the code.

<ListView SelectedValue="{Binding SelectedRule}" 
      IsSynchronizedWithCurrentItem="True"
      Grid.Column="0"
      MinHeight="150"
      VirtualizingStackPanel.IsVirtualizing="True"
      VirtualizingStackPanel.VirtualizationMode="Recycling"
      ScrollViewer.IsDeferredScrollingEnabled="True"
      ItemsSource="{Binding AllRulesInCheckProcess}"
      MaxHeight="300"
      ScrollViewer.HorizontalScrollBarVisibility="Visible">
<ListView.View>
    <GridView>
        <GridViewColumn  DisplayMemberBinding="{Binding Description}" Width="auto">
            <GridViewColumnHeader Content="Description">
                <GridViewColumnHeader.ContentTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <TextBox Height="25" 
                                     FontSize="{StaticResource FontSizeSmall}" 
                                     Text="{Binding ElementName=RulesInCheckProgressPage, Path=DataContext.DescriptionFilter}"
                                     Tag="Filter Description"/>
                            <TextBlock Text="Description"/>
                        </StackPanel>
                    </DataTemplate>
                </GridViewColumnHeader.ContentTemplate>
            </GridViewColumnHeader>
        </GridViewColumn>
        <GridViewColumn DisplayMemberBinding="{Binding LaunchDate,StringFormat=MM/dd/yy}" 
                        Width="auto">
            <GridViewColumnHeader Content="Launch Date">
                <GridViewColumnHeader.ContentTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <TextBox Height="25" 
                                     FontSize="{StaticResource FontSizeSmall}" 
                                     Tag="Filter Launch Date"
                                     Text="{Binding ElementName=RulesInCheckProgressPage, Path=DataContext.LaunchDateFilter}"/>
                            <TextBlock Text="Launch Date"/>
                        </StackPanel>
                    </DataTemplate>
                </GridViewColumnHeader.ContentTemplate>
            </GridViewColumnHeader>

        </GridViewColumn>
        <GridViewColumn DisplayMemberBinding="{Binding AddedDate,StringFormat=MM/dd/yy}" Width="auto">
            <GridViewColumnHeader Content="Added Date">
                <GridViewColumnHeader.ContentTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <TextBox Height="25" 
                                     FontSize="{StaticResource FontSizeSmall}" Tag="Filter Added Date"
                                     Text="{Binding ElementName=RulesInCheckProgressPage, Path=DataContext.AddedDateFilter}"/>
                            <TextBlock Text="Added Date"/>
                        </StackPanel>
                    </DataTemplate>
                </GridViewColumnHeader.ContentTemplate>
            </GridViewColumnHeader>
        </GridViewColumn>
    </GridView>
</ListView.View>

UPDATE

So through doing some more research it appears I may need to take a look at data virtualization instead of UI virtualization. Does anyone know of any up to date data virtualization code?

Selthien
  • 1,178
  • 9
  • 33
  • I think you'll have a much better chance at getting this answered if you provide an [mcve](https://stackoverflow.com/help/mcve). No reason why this shouldn't be virtualizing, from what I can see, have you tried it without the CollapseableColumn behavior? – Mark Feldman Jan 30 '19 at 18:36
  • @MarkFeldman Yes I tried removing the CollapseableColumn behavior. That had no change on the load time / scrolling / click response time. I will try and get rid of a few columns to make it a bit easier to read and see if it helps at all. – Selthien Jan 30 '19 at 18:40

0 Answers0