Removing Tree Indentation in TreeDataGrid for .NET MAUI
Environment
Version | Product | Author |
---|---|---|
11.0.0 | Telerik UI for .NET MAUI TreeDataGrid | Dobrinka Yordanova |
Description
I want to remove the tree indentation in the Telerik TreeDataGrid for .NET MAUI control. This involves customizing the appearance of the ExpandCollapseIndicator
to eliminate the space allocated for tree levels.
This knowledge base article also answers the following questions:
- How to set
LevelIndentation
to zero in TreeDataGrid for .NET MAUI? - How to customize the
ExpandCollapseIndicatorStyle
in TreeDataGrid? - How to control indent spacing in Telerik TreeDataGrid for .NET MAUI?
Solution
To remove the tree indentation, set the LevelIndentation
property of the TreeDataGridExpandCollapseIndicatorAppearance
to 0
. Apply this style to the ExpandCollapseIndicatorStyle
property of the TreeDataGrid.
1. Define a style for TreeDataGridExpandCollapseIndicatorAppearance
in your XAML.
2. Set the LevelIndentation
property value to 0
.
<Style x:Key="style" TargetType="telerik:TreeDataGridExpandCollapseIndicatorAppearance">
<Setter Property="LevelIndentation" Value="0" />
</Style>
3. Assign this style to the ExpandCollapseIndicatorStyle
of the TreeDataGrid.
<telerik:RadTreeDataGrid x:Name="treeDataGrid"
ExpandCollapseIndicatorStyle="{StaticResource style}" />