开发者

WPF Toolkit Data Grid crashing on Binding to 16K row DataTable

开发者 https://www.devze.com 2023-03-19 05:43 出处:网络
I am working on a recreation of a search control using the MVVM pattern. Our current implementation does a lot of code-behind work to create this control.

I am working on a recreation of a search control using the MVVM pattern. Our current implementation does a lot of code-behind work to create this control.

I have a WPF Toolkit Datagrid in SearchControl.xaml

<wtk:DataGrid Name="ResultsGrid"
          Grid.Row="4"
          Grid.ColumnSpan="4"
          Height="Auto"
          AutoGenerateColumns="True"
          ItemsSource="{Binding Path=.}"
          DataContext="{Binding Path=Results}"
          CanUserAddRows="False"
          CanUserDeleteRows="False"
          IsReadOnly="True"
          AutoGeneratedColumns="ResultsGrid_AutoGeneratedColumns"
          VerticalScrollBarVisibility="Auto"/>

The control is bound to a SearchControlViewModel, which has a Results property

    public DataTable Results
    {
        get { return _results; }
        set
        {
            _results = value;
            OnPropertyChanged("Results");
            OnPropertyChanged("ShowResults");
        }
    }

This works fine for smaller data sets, but crashes when given a data table with 16K+ rows. This is essentially a copy of paste reproduction of what is currently imp开发者_如何学JAVAlemented, with the main difference being applying the DataGrid's data context via Binding rather than setting it in the code-behind.

Thanks for any help.


My data grid was not being properly contained by it's parent causing it to not have a vertical size limit. All the rows were being displayed and no virtualization was occurring.

0

精彩评论

暂无评论...
验证码 换一张
取 消