Hello,
I set up a simple WPF window with two grids side-by-side: A Telerik RADGridView and a Microsoft DataGrid. Both grids are set up with 2 levels of hierarchy (master-detail), and are bound to the same data (2 master records, each with 1000 detail records). Both grids have one fixed-width column on the master and detail levels.
On my machine, when I expand a master row on the Microsoft grid for the first time, it takes 4 seconds to display all the details; expanding a master row on the Telerik grid for the first time takes 9 seconds to display the details.
The thing that appears to be taking a long time is rendering the detail rows -- if I limit the height of the detail grid to 200 pixels, it takes less than a second to expand a master for the first time (this is the case with both the Microsoft grid and the Telerik grid).
I reviewed the performance tips/tricks. Is there anything else I can do to reduce the time it takes to expand a master for the first time in the RADGridView?
Any help is much appreciated!
Here is the XAML and code-behind I'm using:
I set up a simple WPF window with two grids side-by-side: A Telerik RADGridView and a Microsoft DataGrid. Both grids are set up with 2 levels of hierarchy (master-detail), and are bound to the same data (2 master records, each with 1000 detail records). Both grids have one fixed-width column on the master and detail levels.
On my machine, when I expand a master row on the Microsoft grid for the first time, it takes 4 seconds to display all the details; expanding a master row on the Telerik grid for the first time takes 9 seconds to display the details.
The thing that appears to be taking a long time is rendering the detail rows -- if I limit the height of the detail grid to 200 pixels, it takes less than a second to expand a master for the first time (this is the case with both the Microsoft grid and the Telerik grid).
I reviewed the performance tips/tricks. Is there anything else I can do to reduce the time it takes to expand a master for the first time in the RADGridView?
Any help is much appreciated!
Here is the XAML and code-behind I'm using:
<
Window
x:Class
=
"MasterDetailPerformance.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Height
=
"360"
Width
=
"760"
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"369"
/>
<
ColumnDefinition
Width
=
"369"
/>
</
Grid.ColumnDefinitions
>
<
StackPanel
Grid.Column
=
"0"
Margin
=
"10"
Height
=
"300"
Width
=
"350"
>
<
TextBlock
Text
=
"Telerik RADGridView:"
/>
<
telerik:RadGridView
x:Name
=
"TelerikMasterGrid"
AutoGenerateColumns
=
"False"
ShowGroupPanel
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Name}"
Width
=
"200"
/>
</
telerik:RadGridView.Columns
>
<
telerik:RadGridView.ChildTableDefinitions
>
<
telerik:GridViewTableDefinition
/>
</
telerik:RadGridView.ChildTableDefinitions
>
<
telerik:RadGridView.HierarchyChildTemplate
>
<
DataTemplate
>
<
telerik:RadGridView
x:Name
=
"TelerikDetailGrid"
ItemsSource
=
"{Binding Details}"
AutoGenerateColumns
=
"False"
ShowGroupPanel
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Name}"
Width
=
"200"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
DataTemplate
>
</
telerik:RadGridView.HierarchyChildTemplate
>
</
telerik:RadGridView
>
</
StackPanel
>
<
StackPanel
Grid.Column
=
"1"
Margin
=
"10"
Height
=
"300"
Width
=
"350"
>
<
TextBlock
Text
=
"Microsoft DataGrid (click row to expand, ctrl-click to collapse):"
/>
<
DataGrid
x:Name
=
"MicrosoftMasterGrid"
AutoGenerateColumns
=
"False"
RowDetailsVisibilityMode
=
"VisibleWhenSelected"
>
<
DataGrid.Columns
>
<
DataGridTextColumn
Binding
=
"{Binding Name}"
Header
=
"Name"
Width
=
"200"
/>
</
DataGrid.Columns
>
<
DataGrid.RowDetailsTemplate
>
<
DataTemplate
>
<
DataGrid
x:Name
=
"MicrosoftDetailsGrid"
AutoGenerateColumns
=
"False"
ItemsSource
=
"{Binding Details}"
>
<
DataGrid.Columns
>
<
DataGridTextColumn
Binding
=
"{Binding Name}"
Width
=
"200"
/>
</
DataGrid.Columns
>
</
DataGrid
>
</
DataTemplate
>
</
DataGrid.RowDetailsTemplate
>
</
DataGrid
>
</
StackPanel
>
</
Grid
>
</
Window
>
public
partial
class
MainWindow : Window
{
private
IList<Master> masterList =
new
List<Master>();
public
MainWindow()
{
InitializeComponent();
FillMasterList();
TelerikMasterGrid.ItemsSource = masterList;
MicrosoftMasterGrid.ItemsSource = masterList;
}
private
void
FillMasterList()
{
for
(
int
index = 0; index < 2; ++index )
{
masterList.Add(
new
Master()
{
ID = index,
Name = index.ToString(),
Details = GetDetails()
} );
}
}
private
IList<Detail> GetDetails()
{
IList<Detail> details =
new
List<Detail>();
for
(
int
index = 0; index < 1000; ++index )
{
details.Add(
new
Detail() { ID = index, Name = index.ToString() } );
}
return
details;
}
}
public
class
Master
{
public
int
ID {
get
;
set
; }
public
string
Name {
get
;
set
; }
public
IList<Detail> Details {
get
;
set
; }
}
public
class
Detail
{
public
int
ID {
get
;
set
; }
public
string
Name {
get
;
set
; }
}