Articles in this section
Category / Section

How to make SfDataGrid scroll like an excel sheet?

1 min read

SfDataGrid provides three types of scrolling mode which can be customized using the SfDataGrid.ScrollingMode property. By default, the SfDataGrid will scroll its content based on pixel values.

  • PixelLine
  • Line
  • Pixel

PixelLine

When SfDataGrid.ScrollingMode is PixelLine, the SfDataGrid will scroll its contents like an excel sheet. i.e., whenever a row or a column is clipped on the top, the particular row or column will be auto scrolled to display fully in view.

SfDataGrid sfGrid;
sfGrid = new SfDataGrid();
sfGrid.ScrollingMode = ScrollingMode.PixelLine;

 

C:\Users\INDHUM~1.MAL\AppData\Local\Temp\msohtmlclip1\02\clip_image001.png


Line Scrolling

When SfDataGrid.ScrollingMode is Line, the SfDataGrid will scroll its contents based on lines. i.e., the view will be updated only when the offset values reaches the origin of a row or column in the bound collection.

SfDataGrid sfGrid;
sfGrid = new SfDataGrid();
sfGrid.ScrollingMode = ScrollingMode.Line;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Pixel Scrolling

When SfDataGrid.ScrollingMode is Pixel, the SfDataGrid will scroll its contents based on pixel values. i.e., the view will be updated each pixel change of the offsets and rows or columns will appear clipped when offset exceeds the origin of the row or column.

SfDataGrid sfGrid;
sfGrid = new SfDataGrid();
sfGrid.ScrollingMode = ScrollingMode.Pixel;

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment