Freeze panes in MAUI DataGrid (SfDataGrid)
17 Dec 20254 minutes to read
In the Syncfusion® .NET MAUI DataGrid (SfDataGrid) control, you can freeze rows and columns in view, similar to Excel. You can freeze rows and columns by setting the following properties:
| Property name | Description |
|---|---|
| FrozenRowCount | Sets the number of rows to freeze at the top of the DataGrid |
| FooterFrozenRowCount | Sets the number of rows to freeze at the bottom (footer) of the DataGrid |
| FrozenColumnCount | Sets the number of columns to freeze at the left side of the DataGrid |
| FooterFrozenColumnCount | Sets the number of columns to freeze at the right side of the DataGrid |
To get start quickly with freeze rows and columns in .NET MAUI DataGrid, you can check on this video:
Freeze columns
You can freeze columns in view, similar to Excel, by setting the SfDataGrid.FrozenColumnCount property to a non-negative value.
The following code snippet shows how to freeze columns in the DataGrid:
<ContentPage xmlns:syncfusion="http://schemas.syncfusion.com/maui">
<syncfusion:SfDataGrid ItemsSource="{Binding OrderInfoCollection}" FrozenColumnCount="1" />
</ContentPage>
Freeze footer columns
You can freeze footer columns in view, similar to Excel, by setting the SfDataGrid.FooterFrozenColumnCount property to a non‑negative value.
The following code snippet shows how to freeze footer columns in the DataGrid:
<ContentPage xmlns:syncfusion="http://schemas.syncfusion.com/maui">
<syncfusion:SfDataGrid ItemsSource="{Binding OrderInfoCollection}" FooterFrozenColumnCount="1" />
</ContentPage>
Limitations
- The
FrozenColumnCountandFooterFrozenColumnCountvalue should be less than the number of columns displayed in the view. For example, if you have 5 columns in the view, you can set theFrozenColumnCountandFooterFrozenColumnCountvalue to a maximum of 4.
Freeze rows
You can freeze rows in view, similar to Excel, by setting the SfDataGrid.FrozenRowCount property to a non-negative value.
The following code snippet shows how to freeze rows in the DataGrid:
<ContentPage xmlns:syncfusion="http://schemas.syncfusion.com/maui">
<syncfusion:SfDataGrid ItemsSource="{Binding OrderInfoCollection}" FrozenRowCount="1" />
</ContentPage>
Freeze footer rows
You can freeze footer rows in view, similar to Excel, by setting the SfDataGrid.FooterFrozenRowCount property to a non‑negative value.
The following code snippet shows how to freeze footer rows in the DataGrid:
<ContentPage xmlns:syncfusion="http://schemas.syncfusion.com/maui">
<syncfusion:SfDataGrid ItemsSource="{Binding OrderInfoCollection}" FooterFrozenRowCount="1" />
</ContentPage>
Limitations
- The
FrozenRowCountandFooterFrozenRowCountvalue should be less than the number of rows displayed in the view. For example, if you have 10 rows in the view, you can set theFrozenRowCountandFooterFrozenRowCountvalue to a maximum of 9.
Appearance
Freeze pane line color
The DataGrid allows you to customize the color of the freeze pane line using the DataGridStyle.FreezePaneLineColor property.
<ContentPage xmlns:syncfusion="http://schemas.syncfusion.com/maui">
<syncfusion:SfDataGrid ItemsSource="{Binding OrderInfoCollection}" FrozenColumnCount="1" FrozenRowCount="1">
<syncfusion:SfDataGrid.DefaultStyle>
<syncfusion:DataGridStyle FreezePaneLineColor="Orange" />
</syncfusion:SfDataGrid.DefaultStyle>
</syncfusion:SfDataGrid>
</ContentPage>
Freeze pane line thickness
The DataGrid provides an option to customize the thickness of the freeze pane line using the DataGridStyle.FreezePaneLineStrokeThickness property. This property defines the stroke width for all frozen rows and columns in both the body and footer regions
NOTE
The default value of
FreezePaneLineStrokeThicknessis 1.
<ContentPage xmlns:syncfusion="http://schemas.syncfusion.com/maui">
<syncfusion:SfDataGrid ItemsSource="{Binding OrderInfoCollection}" FrozenColumnCount="1" FrozenRowCount="1">
<syncfusion:SfDataGrid.DefaultStyle>
<syncfusion:DataGridStyle FreezePaneLineStrokeThickness="5" />
</syncfusion:SfDataGrid.DefaultStyle>
</syncfusion:SfDataGrid>
</ContentPage>