Hi,
We have a custom data virtualization component that we use as the itemsource for the radgridview. The data virtualization component is build on the sample project at the following location
http://www.codeproject.com/KB/WPF/WpfDataVirtualization.aspx
In my project,I have downloaded the source from the above site and I have 2 windows , one that contains a wpf toolkit grid (ToolkitDataGrid.xaml) and the other that contains the telerik grid (TelerikDataGrid.xaml). The wpf grid works well with the virtualization component and only fetches rows that are in the visible area of the grid.
The telerik grid on the other hand fetches all the rows instead of only the visible ones.
This is a very critical requirement and I would be very grateful for any help/assistance.
With Windows datagrid
C# code behind
The same thing with the telerik grid:
c# code behind
We have a custom data virtualization component that we use as the itemsource for the radgridview. The data virtualization component is build on the sample project at the following location
http://www.codeproject.com/KB/WPF/WpfDataVirtualization.aspx
In my project,I have downloaded the source from the above site and I have 2 windows , one that contains a wpf toolkit grid (ToolkitDataGrid.xaml) and the other that contains the telerik grid (TelerikDataGrid.xaml). The wpf grid works well with the virtualization component and only fetches rows that are in the visible area of the grid.
The telerik grid on the other hand fetches all the rows instead of only the visible ones.
This is a very critical requirement and I would be very grateful for any help/assistance.
With Windows datagrid
<
Window
x:Class
=
"DataVirtualization.ToolkitDataGrid"
xmlns:x
=
"http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dg
=
"clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
Title
=
"ToolkitDataGrid"
Height
=
"600"
Width
=
" 700"
>
<
Grid
>
<
Button
Height
=
"50"
Width
=
" 100"
Content
=
"Load"
Click
=
"Button_Click"
VerticalAlignment
=
"Top"
/>
<
dg:DataGrid
Name
=
"dataGrid"
Margin
=
"5,100,5,5"
ItemsSource
=
"{Binding}"
AutoGenerateColumns
=
"False"
ScrollViewer.IsDeferredScrollingEnabled
=
"True"
VirtualizingStackPanel.VirtualizationMode
=
"Recycling"
VirtualizingStackPanel.IsVirtualizing
=
"True"
>
<
dg:DataGrid.Columns
>
<
dg:DataGridTextColumn
Binding
=
"{Binding Id}"
Header
=
"Id"
/>
<
dg:DataGridTextColumn
Binding
=
"{Binding Name}"
Header
=
"Name"
/>
</
dg:DataGrid.Columns
>
</
dg:DataGrid
>
</
Grid
>
</
Window
>
C# code behind
using
System.Windows;
namespace
DataVirtualization
{
/// <summary>
/// Interaction logic for ToolkitDataGrid.xaml
/// </summary>
public
partial
class
ToolkitDataGrid : Window
{
public
ToolkitDataGrid()
{
InitializeComponent();
}
private
void
Button_Click(
object
sender, RoutedEventArgs e)
{
DemoCustomerProvider customerProvider =
new
DemoCustomerProvider(1000000, 1000);
var results=
new
VirtualizingCollection<Customer>(customerProvider, 20);
DataContext = results;
}
}
}
The same thing with the telerik grid:
<
Window
xmlns:x
=
"http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
xmlns:GridView
=
"clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
x:Class
=
"DataVirtualization.TelerikDataGrid"
Title
=
"TelerikDataGrid"
Height
=
"600"
Width
=
" 700"
>
<
Grid
>
<
Button
Height
=
"50"
Width
=
" 100"
Content
=
"Load"
Click
=
"Button_Click"
VerticalAlignment
=
"Top"
/>
<
Controls:RadGridView
x:Name
=
"dataGrid"
Margin
=
"5,100,5,5"
ItemsSource
=
"{Binding}"
AutoGenerateColumns
=
"False"
ScrollViewer.IsDeferredScrollingEnabled
=
"True"
VirtualizingStackPanel.VirtualizationMode
=
"Recycling"
VirtualizingStackPanel.IsVirtualizing
=
"True"
DataLoadMode
=
"Asynchronous"
>
<
Controls:RadGridView.Columns
>
<
Controls:GridViewDataColumn
DataMemberBinding
=
"{Binding Id}"
Header
=
"Id"
/>
<
Controls:GridViewDataColumn
DataMemberBinding
=
"{Binding Name}"
Header
=
"Name"
/>
</
Controls:RadGridView.Columns
>
</
Controls:RadGridView
>
</
Grid
>
</
Window
>
c# code behind
using
System.Windows;
namespace
DataVirtualization
{
/// <summary>
/// Interaction logic for TelerikDataGrid.xaml
/// </summary>
public
partial
class
TelerikDataGrid : Window
{
public
TelerikDataGrid()
{
InitializeComponent();
}
private
void
Button_Click(
object
sender, RoutedEventArgs e)
{
DemoCustomerProvider customerProvider =
new
DemoCustomerProvider(1000000, 1000);
var results =
new
VirtualizingCollection<Customer>(customerProvider, 20);
DataContext = results;
}
}
}