Freeze panes in MAUI DataGrid (SfDataGrid)

27 Jun 20242 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
FrozenColumnCount Sets the number of columns to freeze at the left 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 columns .NET MAUI DataGrid

Limitations

  • The FrozenColumnCount value 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 the FrozenColumnCount value 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 rows .NET MAUI DataGrid

Limitations

  • The FrozenRowCount value 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 the FrozenRowCount value to a maximum of 9.

Appearance

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>

Customize freeze panes appearance in .NET MAUI DataGrid