|
| 1 | +--- |
| 2 | +title: Removing Tree Indentation in TreeDataGrid for .NET MAUI |
| 3 | +description: Learn how to remove the tree indentation in the Telerik TreeDataGrid for .NET MAUI control. |
| 4 | +type: how-to |
| 5 | +page_title: How to Remove Tree Indentation in Telerik TreeDataGrid for .NET MAUI |
| 6 | +slug: remove-tree-indentation-treedatagrid-dotnet-maui |
| 7 | +tags: treedatagrid,.net maui,levelindentation,styling |
| 8 | +res_type: kb |
| 9 | +ticketid: 1689581 |
| 10 | +--- |
| 11 | + |
| 12 | +## Environment |
| 13 | + |
| 14 | +| Version | Product | Author | |
| 15 | +| --- | --- | ---- | |
| 16 | +| 11.0.0 | Telerik UI for .NET MAUI TreeDataGrid | [Dobrinka Yordanova](https://www.telerik.com/blogs/author/dobrinka-yordanova) | |
| 17 | + |
| 18 | +## Description |
| 19 | + |
| 20 | +I want to remove the tree indentation in the Telerik [TreeDataGrid](https://docs.telerik.com/devtools/maui/controls/treedatagrid/overview) for .NET MAUI control. This involves customizing the appearance of the `ExpandCollapseIndicator` to eliminate the space allocated for tree levels. |
| 21 | + |
| 22 | +This knowledge base article also answers the following questions: |
| 23 | +- How to set `LevelIndentation` to zero in TreeDataGrid for .NET MAUI? |
| 24 | +- How to customize the `ExpandCollapseIndicatorStyle` in TreeDataGrid? |
| 25 | +- How to control indent spacing in Telerik TreeDataGrid for .NET MAUI? |
| 26 | + |
| 27 | +## Solution |
| 28 | + |
| 29 | +To remove the tree indentation, set the `LevelIndentation` property of the `TreeDataGridExpandCollapseIndicatorAppearance` to `0`. Apply this style to the `ExpandCollapseIndicatorStyle` property of the TreeDataGrid. |
| 30 | + |
| 31 | +**1.** Define a style for `TreeDataGridExpandCollapseIndicatorAppearance` in your XAML. |
| 32 | + |
| 33 | +**2.** Set the `LevelIndentation` property value to `0`. |
| 34 | + |
| 35 | +```xaml |
| 36 | +<Style x:Key="style" TargetType="telerik:TreeDataGridExpandCollapseIndicatorAppearance"> |
| 37 | + <Setter Property="LevelIndentation" Value="0" /> |
| 38 | +</Style> |
| 39 | +``` |
| 40 | + |
| 41 | +**3.** Assign this style to the `ExpandCollapseIndicatorStyle` of the TreeDataGrid. |
| 42 | + |
| 43 | +```xaml |
| 44 | +<telerik:RadTreeDataGrid x:Name="treeDataGrid" |
| 45 | + ExpandCollapseIndicatorStyle="{StaticResource style}" /> |
| 46 | +``` |
| 47 | + |
| 48 | +## See Also |
| 49 | + |
| 50 | +- [TreeDataGrid Style]({%slug treedatagrid-styling%}) |
0 commit comments