GrayDS
GrayDS

Reputation: 363

WPF ListView very poor performance with large data

I am experiencing very poor performance with a ListView in WPF, using around 30000 records. As far as I know Virtualisation should be turned on as this is the default (I even turned it on explicitly in the XAML).

The poor performance manifests in this way:

I was hoping someone would take a look at the XAML and let me have some thoughts.

<ListView Name="grdComms" Grid.Row="0" Grid.Column="0" SelectedItem="{Binding SelectedHeader}"
          VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling"
          ScrollViewer.IsDeferredScrollingEnabled="True">
       <ListView.View>
            <GridView >
                  <GridViewColumn Header="Account Name" DisplayMemberBinding="{Binding Path=AccountName}" Width="150" />
                  <GridViewColumn Header="Account Number" DisplayMemberBinding="{Binding Path=AccountNumber}" Width="120" />
                  <GridViewColumn Header="Type" DisplayMemberBinding="{Binding Path=Type}" Width="80" />
                  <GridViewColumn Header="Delivery" DisplayMemberBinding="{Binding Path=Delivery}" Width="80" />
                  <GridViewColumn Header="Count" DisplayMemberBinding="{Binding Path=RequestCount}" Width="80" />
                  <GridViewColumn Width="80" Header="DeDupe">
                       <GridViewColumn.CellTemplate>
                           <DataTemplate>
                               <StackPanel Width="80">
                                   <CheckBox HorizontalAlignment="Center" IsChecked="{Binding Path=SelectedForProcessing, Mode=TwoWay}"/>
                                </StackPanel>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                  </GridViewColumn>
             </GridView>
      </ListView.View>
</ListView>

Note: the ItemsSource is set in code, to an ObservableCollection. This is a collection of pretty plain properties (couple of strings, a bool), which is a ViewModel onto the Model, which is (again) strings and bools.

I'm reading where people are using large record sets with no problems, but the various things I have tried don't seem to work.

Any more information required please let me know.

Upvotes: 2

Views: 6345

Answers (1)

GrayDS
GrayDS

Reputation: 363

Please ignore me. The problem entirely disappears as soon as I set the MaxHeight of the ListView to something bigger than it needs. I would swear blind I tried this, obviously not.

Move along, there is nothing to see here ...

Gray

Upvotes: 6

Related Questions