DataGrid for WPF and Silverlight Overview > DataGrid Features > Deferred Scrolling |
DataGrid for WPF and Silverlight supports both real time and deferred scrolling. By default, real time scrolling is used and as a user moves the thumb button or clicks the scroll button the grid scrolls. In deferred scrolling, the grid is not scrolled until the user releases the scrollbar thumb; the grid does not move as the scrollbar thumb is moved. You might want to implement deferred scrolling in your application if the grid contains a large amount of data or to optimize scrolling.
You can determine how the grid is scrolled by setting the ScrollMode property. The ScrollMode property accepts the following values from the DataGridScrollMode enumeration.
The example below sets the grid to deferred scrolling mode.
In XAML
To set the grid to deferred scrolling mode, add ScrollMode="Deferred" to the <c1:C1DataGrid> tag so that it appears similar to the following:
XAML |
Copy Code
|
---|---|
<c1:C1DataGrid x:Name="c1DataGrid1" ScrollMode="Deferred"> |
In Code
To set the grid to deferred scrolling mode, set the ScrollMode property to Deferred. For example:
Visual Basic |
Copy Code
|
---|---|
Me.C1DataGrid1.ScrollMode = DataGridScrollMode.Deferred
|
C# |
Copy Code
|
---|---|
this.c1DataGrid1.ScrollMode = DataGridScrollMode.Deferred;
|