Skip to main content

ColumnHeaderStyle Class

Stores the column header appearance settings.

Namespace: DevExpress.Maui.DataGrid

Assembly: DevExpress.Maui.DataGrid.dll

Declaration

public class ColumnHeaderStyle :
    RowStyleBase

The following members accept/return ColumnHeaderStyle objects:

Remarks

The ColumnHeaderStyle class properties customize the following appearance parameters of a column header:

Data Grid - Column Header Style

You can specify a style and apply it to grid column headers in one of the following ways:

  • Assign a ColumnHeaderStyle object with the specified properties to the DataGridView.ColumnHeaderStyle property.
  • Create a Microsoft.Maui.Controls.Style class instance with the specified collection of Setter objects, and set the Style.TargetType property to ColumnHeaderStyle.

Example

This example shows how to modify the appearance of the following grid elements:

Data Cells
Assign the CellStyle object with the specified settings to the DataGridView.CellStyle property. Use the grid’s RowHeight property to specify the cell height.
Column Headers
Assign the ColumnHeaderStyle object with the specified settings to the DataGridView.ColumnHeaderStyle property.
Total Summary Panel
Assign the TotalSummaryStyle object with the specified settings to the DataGridView.TotalSummaryStyle property. Use the grid’s TotalSummaryHeight property to change the height of the total summary panel displayed at the bottom of the grid.

Data Grid - Custom Appearance

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:dxg="clr-namespace:DevExpress.Maui.DataGrid;assembly=DevExpress.Maui.DataGrid"
             xmlns:local="clr-namespace:DataGrid_CustomAppearance"
             x:Class="DataGrid_CustomAppearance.MainPage">
    <ContentPage.BindingContext>
        <local:TestOrderRepository/>
    </ContentPage.BindingContext>
    <dxg:DataGridView ItemsSource="{Binding Orders}" 
                      RowHeight="40" TotalSummaryHeight="40">

        <!-- Specify grid columns and total summaries here. -->

        <!--Customize the appearance of grid cells.-->
        <dxg:DataGridView.CellStyle>
            <dxg:CellStyle Padding="5" BackgroundColor="#333333" BorderColor="#515151"
                           FontSize="14" FontColor="White" 
                           SelectionColor="#f78a09" SelectionFontColor="Black"/>
        </dxg:DataGridView.CellStyle>

        <!--Customize the appearance of column headers.-->
        <dxg:DataGridView.ColumnHeaderStyle>
            <dxg:ColumnHeaderStyle BackgroundColor="#333333" BorderColor="#515151" 
                                   FontSize="16" FontColor="#929292" FontAttributes="Bold" 
                                   HorizontalLineThickness="2"/>
        </dxg:DataGridView.ColumnHeaderStyle>

        <!--Customize the appearance of the total summary panel.-->
        <dxg:DataGridView.TotalSummaryStyle>
            <dxg:TotalSummaryStyle Padding="2,10" BackgroundColor="#666666" BorderColor="#515151"
                                   FontSize="14" FontColor="#f78a09"/>
        </dxg:DataGridView.TotalSummaryStyle>
    </dxg:DataGridView>
</ContentPage>

Implements

Microsoft.Maui.Controls.IElementController

Inheritance

Object
Microsoft.Maui.Controls.BindableObject
Microsoft.Maui.Controls.Element
StyleBase
RowStyleBase
ColumnHeaderStyle
See Also