New to Telerik UI for .NET MAUI? Start a free 30-day trial

.NET MAUI DataGrid Styling

The .NET MAUI DataGrid control enables you to customize its look and feel through the available Style configuration options. Also, you can modify the appearance of its splitter element, which divides the frozen columns from the rest of the data.

Border Brush and Thickness

Style supports the following properties for styling the border brush and thickness of the DataGrid:

  • BorderBrush—Defines the brush of the border placed around the DataGrid control.
  • BorderThickness—Defines the thickness of the border around the DataGrid control.

The following snippet shows how to set the BorderBrush and BorderThickness properties of the DataGrid control:

 <telerik:RadDataGrid x:Name="DataGrid"

The next image shows the end result.

Styling the border brush and border thickness of the Telerik UI for .NET MAUI DataGrid

Cells and Rows

Style supports the following properties for styling the cells and rows of the DataGrid:

  • RowBackgroundStyle—Defines the style of each row.
  • AlternateRowBackgroundStyle—Defines the appearance style of an alternated row.
  • SelectionStyle—Defines the appearance settings applied to the selected DataGrid row.
  • CurrentCellStyle—Defines the style applied to the current cell.
  • MouseHoverStyle—Specifies the style applied to the cells and rows when the mouse is over them. The style is applicable for Desktop (MacCatalyst and WinUI).

The RowBackgroundStyle, AlternateRowBackgroundStyle, SelectionStyle, CurrentCellStyle, and MouseHoverStyle styling options are of type DataGridBorderStyle. DataGridBorderStyle defines the appearance settings applied to a BorderPaintable instance and exposes the BackgroundColor, BorderColor, and BorderTickness properties.

The following example shows how to set the RowBackgroundStyle property:

    <telerik:DataGridBorderStyle BackgroundColor="#E0F2F1" />

The next example demonstrates how to set the AlternateRowBackgroundStyle property:

    <telerik:DataGridBorderStyle BackgroundColor="#F2FAF9" />

The following snippet shows how to set the SelectionStyle property:

    <telerik:DataGridBorderStyle BackgroundColor="#B2DFDB"
                                 BorderThickness="{OnIdiom Default=0, Phone=1}" />

For styling the CurrentCell by using the CurrentCellStyle property, review the Cells article.

Text on Hover

Style supports the HoverTextColor property which defines the text color of the hovered cell, as demonstrated in the following example.

<telerik:DataGridTextColumn PropertyName="Name"
        <telerik:DataGridTextCellStyle TextColor="Green"
                                        SelectedTextColor="Orange"  />   


Style supports the following properties for configuring the DataGrid lines:

  • GridLinesVisibility(Telerik.Maui.Controls.DataGrid.GridLinesVisibility)—Defines which DataGrid lines are currently visible (displayed). The property accepts the Both, Horizontal, None, and Vertical values.
  • GridLinesColor—Defines the appearance of the horizontal and vertical DataGrid lines.
  • GridLinesThickness—Defines the width of the vertical and the height of the horizontal DataGrid lines.

You can set the GridLinesVisibility property in the following way:

 <telerik:RadDataGrid GridLinesVisibility="Both"
                             ItemsSource="{Binding GridSource}"
                             GridLinesThickness="5" />

Frozen Columns

Style supports the FrozenColumnsSplitterStyle (Telerik.Maui.Controls.DataGrid.DataGridFrozenColumnsSplitterStyle) property which allows you to style the UI of the splitter dividing the frozen (locked) from the unfrozen (unlocked) columns.

Splitter UI

To style the appearance of the splitter, which appears when the user freezes (locks) DataGrid columns, use the Width, BackgroundColor, BorderColor, and BorderThickness properties.

    <telerik:DataGridFrozenColumnsSplitterStyle Width="20"

See Also

In this article