We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to show multi-line header text in a SfDataGrid?

Platform: Xamarin.Forms |
Control: SfDataGrid
Tags: formatting

SfDataGrid allows you to customize the header text for a GridColumn by using the HeaderText property. However by default the grid displays only single line of text in the header and hence when you load a longer header text, the SfDataGrid clips them and displays an ellipsoid at the end.


In case, if longer text need to be displayed in the header, then SfDataGrid allows you to achieve it by using the HeaderTemplate property in the GridColumn. The HeaderTemplate replaces the default header view. Hence you can use it to load a label with LineBreakMode property being set to WordWrap. This will wrap the header text to the next line. You can use the HeaderRowHeight property to customize the header row height as required based on your header text.


Refer the following code example which illustrates how to show multiline header in SfDataGrid.



The following screenshot shows the final outcome on executing the above code.





You can download a working sample for this KB from the below link.


2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
You must log in to leave a comment
Sylvain Gravel
Aug 18, 2016
Is there a way to bind the label's text to the Column's HeaderText property?
Sylvain Gravel
Aug 18, 2016
Got it!!!

                <Label Text="{Binding CellValue}"
                       LineBreakMode="WordWrap"  />

Sylvain Gravel
Aug 18, 2016
Note that you should use


Christian Campos
May 10, 2020

In iOS doesn't work at all, for example, when grid loads, the headers show fine, but when the datasource is refreshed, the headers "reset" its position and all header's text are in just one line.


Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile