Articles in this section
Category / Section

How to customize the header text of a grid column with different colors in .NET MAUI DataGrid?

2 mins read

The .NET MAUI DataGrid allows you to customize the header text of a grid column with different colors using the SfDataGrid.HeaderTemplate. You can load two labels inside a StackLayout with a horizontal orientation and customize the text color of the Labels to achieve the requirement.

The code example below illustrates how to customize the header text of a DataGridColumn with different colors using the DataGridColumn.HeaderTemplate.

XAML

<syncfusion:DataGridTextColumn MappingName="EmployeeID" CellTextAlignment="Center" >
    <syncfusion:DataGridTextColumn.HeaderTemplate>
        <DataTemplate>
            <StackLayout Orientation="Horizontal" HorizontalOptions="Center" Spacing="10" VerticalOptions="Center">
                <Label Text="Order" TextColor="DarkCyan" />
                <Label Text="ID" TextColor="Gold" />
            </StackLayout>
        </DataTemplate>
    </syncfusion:DataGridTextColumn.HeaderTemplate>                
</syncfusion:DataGridTextColumn>

The following screenshot shows how to customize the header text of a grid column with different colors.

SfDatagrid_with_different_HeaderColor.png

Download the complete sample from GitHub

Conclusion
I hope you enjoyed learning how to customize the header text of a grid column with different colors.

You can refer to our .NET MAUI DataGrid feature tour page to learn about its other groundbreaking feature representations. Explore our .NET MAUI DataGrid Documentation to understand how to present and manipulate data.
For current customers, check out our .NET MAUI components from the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to check out our .NET MAUI DataGrid and other .NET MAUI components.
Please let us know in the comments section if you have any queries or require clarification. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please  to leave a comment
Access denied
Access denied