Rows in UWP DataGrid (SfDataGrid)

12 Mar 202419 minutes to read

This section explains about various row types in SfDataGrid.





Row Header

RowHeader is a special column used to indicate the status of row (current row, editing status, errors in row, etc.) which is placed as first cell of each row. You can show or hide the row header by setting SfDataGrid.ShowRowHeader property.

<syncfusion:SfDataGrid x:Name="dataGrid"
                       ItemsSource="{Binding Orders}"
dataGrid.ShowRowHeader = true;

Row Header in UWP DataGrid

You can change the width of row header by setting SfDataGrid.RowHeaderWidth property.

Row indicators and its description

Row Indicator Description
Current cell in the row in UWP DataGridUWP DataGrid Current cell Denotes the row which has current cell or has selected item.
Edited row in UWP DataGridUWP DataGrid Edited row Denotes row is being edited.
Adding new row in UWP DataGridUWP DataGrid AddNewRow Denotes row is AddNewRow.
Rows with errors in UWP DataGridUWP DataGrid Rows with errors Denotes the row has errors.
Current rows with errors in UWP DataGridUWP DataGrid Current rows Denotes that the current row which has errors.

See also.

Show row index in RowHeader

Customizing RowHeader based on record

Header Row

Header row is present in top of the SfDataGrid which has column headers in it. Column header describes the caption to identify the column content.

Show the column header in Header row in UWP DataGrid

You can change the header row height by setting SfDataGrid.HeaderRowHeight property.

Hiding Header row

You can hide the header row by setting SfDataGrid.HeaderRowHeight as 0 (zero).

<syncfusion:SfDataGrid x:Name="dataGrid"
                       ItemsSource="{Binding Orders}">

You can also hide the header row of DetailsViewDataGrid by setting HeaderRowHeight as 0 (zero) to ViewDefinition.DataGrid.

<syncfusion:SfDataGrid x:Name="dataGrid" ItemsSource="{Binding Orders}">
        <syncfusion:GridViewDefinition RelationalColumn="ProductDetails">
                <syncfusion:SfDataGrid x:Name="FirstLevelNestedGrid" HeaderRowHeight="0" />
</ syncfusion:SfDataGrid>

Hiding the row header in details view datagrid

Freeze panes

SfDataGrid provides support to freeze the rows and columns at top and bottom similar to excel. You can freeze the rows and columns by setting following properties,

Property Name Description


Set the frozen rows count at top of the SfDataGrid.


Set the footer rows count at bottom of the SfDataGrid.


Set the frozen columns count in left side of the SfDataGrid.


Set the frozen columns in right side of the SfDataGrid.
<syncfusion:SfDataGrid x:Name="dataGrid"
                       ItemsSource="{Binding Orders}">
dataGrid.FooterColumnCount = 1;
dataGrid.FrozenColumnCount = 1;
dataGrid.FrozenRowsCount = 2;
dataGrid.FrozenRowsCount = 3;

Show the Fotter column, Footer rows, Frozen column , Frozen rows in SfDataGrid

Differentiate frozen rows from normal rows

You can differentiate the frozen rows and footer rows from normal rows by writing style for VirtualizingCellsControl and by customizing the FrozenRow and FooterRow visual states.

<Style TargetType="syncfusion:VirtualizingCellsControl">
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="BorderBrush" Value="Gray" />
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="RowHighlightBorderThickness" Value="0" />
    <Setter Property="Template">
            <ControlTemplate TargetType="syncfusion:VirtualizingCellsControl">
                        <VisualStateGroup x:Name="BorderStates">

                            <VisualState x:Name="NormalRow" />

                            <VisualState x:Name="FrozenRow">
                                <Storyboard BeginTime="0">

                                    <ObjectAnimationUsingKeyFrames BeginTime="0"

                                        <!--  Border Thickness for Frozen rows  -->
                                        <DiscreteObjectKeyFrame KeyTime="0" Value="0, 0, 0, 4" />


                            <VisualState x:Name="FooterRow">
                                <Storyboard BeginTime="0">
                                    <ObjectAnimationUsingKeyFrames BeginTime="0"

                                        <!--  Border Thickness for Footer rows  -->
                                        <DiscreteObjectKeyFrame KeyTime="0" Value="0, 4, 0, 0" />


                                    <ObjectAnimationUsingKeyFrames BeginTime="0"

                                        <DiscreteObjectKeyFrame KeyTime="0" Value="0, -1, 0, 0" />


                    <Border x:Name="PART_RowBorder"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}" />

                    <Rectangle x:Name="PART_CurrentFocusRow"
                                       Margin="{TemplateBinding CurrentFocusBorderMargin}"
                                       Visibility="{TemplateBinding CurrentFocusRowVisibility}" />

                    <Rectangle x:Name="PART_RowBackgroundClipRect" Fill="{TemplateBinding Background}" />

                    <Border x:Name="PART_RowSelectionBorder"
                                    Background="{TemplateBinding RowSelectionBrush}"
                                    Visibility="{TemplateBinding SelectionBorderVisiblity}" />

                    <Border x:Name="PART_RowHighlightBorder"
                                    Background="{TemplateBinding RowHoverBackgroundBrush}"
                                    BorderBrush="{TemplateBinding RowHoverBackgroundBrush}"
                                    BorderThickness="{TemplateBinding RowHighlightBorderThickness}"
                                    Visibility="{TemplateBinding HighlightSelectionBorderVisiblity}" />

                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">

                        <ContentPresenter />

Show the differentiation of Frozen Rows and Fotter Rows from normal rows

Disable drag and drop between frozen and non-frozen columns

You can disable the drag and drop between frozen and non-frozen columns by handling QueryColumnDragging event.

Using Reason property in QueryColumnDraggingEventArgs, you can cancel the column dropping operation.

In the below code, if the Reason is QueryColumnDraggingReason.Dropping and the column is dragged from frozen region to non-frozen region or vice versa, you can cancel the dropping action by setting e.Cancel as true in the event.

this.dataGrid.QueryColumnDragging += DataGrid_QueryColumnDragging;

private void DataGrid_QueryColumnDragging(object sender, QueryColumnDraggingEventArgs e)
    if (e.Reason == QueryColumnDraggingReason.Dropping)
        //used to get frozen column index from the  frozen column count
        var frozenColIndex = dataGrid.FrozenColumnCount + this.dataGrid.ResolveToStartColumnIndex();
        //cancels dragging from frozen column to non-frozen column
        if (e.From < frozenColIndex && e.To > frozenColIndex - 1)
            e.Cancel = true;
        // cancels dragging from non-frozen column to frozen column
        if (e.From > frozenColIndex && e.To < frozenColIndex ||
                (e.From == frozenColIndex && e.To < frozenColIndex))
            e.Cancel = true;


  1. When using DetailsView with freeze panes, exception will be raised like “DetailsView is not supported with Freeze panes support”.

  2. When AllowFrozenGroupHeaders is true, frozen rows will not be considered.

  3. SfDataGrid has support to freeze the number of rows from top or bottom. There is no support to freeze a specific row.


  1. Header rows, table summary rows and row header are frozen regardless of FrozenRowsCount and FooterRowsCount.

  2. FrozenRowsCount and FooterRowsCount values should be less than the number of rows and column visible.