Skip to content

SyncfusionExamples/show-multi-line-header-text-in-maui-datagrid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Show Multi line Header Text in MAUI DataGrid

In.NET MAUI DataGrid (SfDataGrid) allows you to customize the header text for a column using the HeaderText property. However, by default, the grid only displays one line of text in the header, and any longer header text will be clipped and show an ellipsis at the end.

To display longer header text, you can use the HeaderTemplate property in the DataGridColumn. This property replaces the default header view, and you can use it to display a label with the LineBreakMode property set to WordWrap. This will wrap the header text to the next line. Additionally, you can use the HeaderRowHeight property to adjust the header row height as needed, depending on the length of your header text. Refer the below code example which illustrates how to show multiline header in SfDataGrid.

XAML

<ContentPage.BindingContext>
        <local:EmployeeViewModel x:Name="viewModel"/>
    </ContentPage.BindingContext>
<syncfusion:SfDataGrid x:Name="dataGrid"
                        ItemsSource="{Binding Employees}" HeaderRowHeight="70">
    <syncfusion:SfDataGrid.Columns>
        <syncfusion:DataGridTextColumn MappingName="EmployeeID">
            <syncfusion:DataGridTextColumn.HeaderTemplate>
                <DataTemplate>
                    <Label Text="Demo For Multi line Text in header"
                TextColor="Black" VerticalOptions="Fill"
                LineBreakMode="WordWrap"  />
                </DataTemplate>
            </syncfusion:DataGridTextColumn.HeaderTemplate>
        </syncfusion:DataGridTextColumn>
    </syncfusion:SfDataGrid.Columns>
</syncfusion:SfDataGrid>

MultiLineHeader

Conclusion

I hope you enjoyed learning about how to add MultiLine Header text in MAUI DataGrid (SfDataGrid). You can refer to our .NET MAUI DataGrid’s feature tour page to know about its other groundbreaking feature representations. You can also explore our .NET MAUI DataGrid Documentation to understand how to present and manipulate data. For current customers, you can check out our .NET MAUI components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our .NET MAUI DataGrid and other .NET MAUI components. If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac or feedback portal. We are always happy to assist you!

About

show multi-line header text in maui datagrid

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5

Languages