WinUI grid loads slowly

0 Answers 59 Views
Miscellaneous
Carl
Top achievements
Rank 1
Carl asked on 28 Sep 2022, 08:13 PM

Using the trial version.

I have a grid in my application that is structured like this.

            <telerikGrid:RadDataGrid x:Name="SearchGrid" 

                                            ItemsSource="{x:Bind ViewModel.Results, Mode=TwoWay }"
                                             AutoGenerateColumns="False"
                                             RowHeight="25"
                                             SelectionMode="Single"
                                             SelectionUnit="Row"
                                             UserGroupMode="Disabled"
                                             ScrollViewer.VerticalScrollBarVisibility="Auto"
                                             ScrollViewer.HorizontalScrollBarVisibility="Auto">
                <telerikGrid:RadDataGrid.Columns>
                    <telerikGrid:DataGridTextColumn PropertyName="_BoClientId" Header="BO Client ID" Width="25"/>
                    <telerikGrid:DataGridTextColumn PropertyName="_BOName" Header="BO Name" Width="80"/>
                </telerikGrid:RadDataGrid.Columns>
            </telerikGrid:RadDataGrid>

When I load the Results ObservableCollection with 1000 or so rows it handles quickly. However, when I do several thousand (in my test about 8200) its very slow and takes several seconds to even select a different row. The demo takes a different approach and binds in this fashion:

ItemsSource="{Binding Data, Source={StaticResource Model}}"

When I try that no data appears at all. I modified the demo to display 24K+ rows and its handles very quickly

What am I doing wrong?

Thanks

Carl

 

 

Martin Ivanov
Telerik team
commented on 30 Sep 2022, 08:58 AM

I've tested your code with 9000 items and it works smoothly on my side. Can you please check the attached project and let me know if I am missing anything?

Also, note that this kind of performance issue can happen if the DataGrid control is placed in a panel that measure its children with infinity. For example, this could be a StackPanel or a Grid's Row/ColumnDefinition with Height/Width set to Auto. If this is your case, move the DataGrid in a panel that measures its items with the available space. For example, a Grid.

No answers yet. Maybe you can help?

Tags
Miscellaneous
Asked by
Carl
Top achievements
Rank 1
Share this question
or