Hierarchical Template Entire TreeView Width

1 Answer 40 Views
TreeView
Johnathan
Top achievements
Rank 1
Johnathan asked on 02 Oct 2023, 02:16 PM
When I use a Hierarchical Template for generating a TreeView the branches of the TreeView wont use the entire width of the TreeView, even when I use a Grid with a column of * width.  Is there a way to get the template content to make use of the entire width?

1 Answer, 1 is accepted

Sort by
0
Dinko
Telerik team
answered on 04 Oct 2023, 10:12 AM

Hello Johnathan,

The content of the RadTreeViewItems is not stretched because the presenter that holds it is horizontally aligned to Left. In order to achieve your requirement and stretch the Grid defined in the treeview's ItemTemplate you can set the HorizontalContentAlignment property of the RadTreeViewItems to Stretch.

<telerik:RadTreeView.ItemContainerStyle>
	<Style TargetType="telerik:RadTreeViewItem">
		<Setter Property="HorizontalContentAlignment" Value="Stretch" />
	</Style>
</telerik:RadTreeView.ItemContainerStyle>

In addition to this I attached a sample solution where this logic is implemented.

Regards,
Dinko
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
TreeView
Asked by
Johnathan
Top achievements
Rank 1
Answers by
Dinko
Telerik team
Share this question
or