Freeze Panes in Xamarin DataGrid (SfDataGrid)
31 May 20211 minute to read
The SfDataGrid allows to freeze the rows and columns when scrolling the grid.
Freeze rows
The SfDataGrid provides extensive support to freeze the rows at the top of the view below the header row by setting the SfDataGrid.FrozenRowsCount property.
The following code example illustrates freezing two rows:
//Setting number of rows to freeze in SfDataGrid
dataGrid.FrozenRowsCount = 2;
Limitation
-
FrozenRowsCount
should be lesser than the number of rows displayed in view. For example, If you have 10 rows in view, then you setFrozenRowsCount
to a maximum value of 9.
NOTE
Header row is frozen by default and works regardless of the
FrozenRowsCount
property.
Freeze columns
The SfDataGrid also supports to freeze the columns at the left of the view by setting the SfDataGrid.FrozenColumnsCount property.
The following code example illustrates freezing two columns:
//Setting number of columns to freeze in SfDataGrid
dataGrid.FrozenColumnsCount = 2;
Limitation
-
FrozenColumnsCount
should be lesser than number of columns displayed in view. For example, If you have 5 columns in view, then you can setFrozenColumnsCount
to a maximum value of 4.
NOTE
RowHeader is frozen by default and works regardless of the
FrozenColumnsCount
property.
The following GIF illustrates FrozenRows and FrozenColumns.
NOTE
You can refer to our Xamarin DataGrid feature tour page for its groundbreaking feature representations. You can also explore our Xamarin.Forms DataGrid example to knows various chart types and how to easily configured with built-in support for creating stunning visual effects.