Publishing the Expand(object dataItem) Method in the RadTreeView

1 Answer 51 Views
TreeView
LZI
Top achievements
Rank 1
LZI asked on 15 Dec 2025, 12:42 PM

Expanding an element chain in the TreeView is quite cumbersome when using different descriptors with different templates, as the provided method Expand(IEnumerable itemPath) requires complex preparation and, depending on the context, different preparation mechanisms.

It would be desirable if the already existing method Expand(object dataItem) from the TreeViewAdapter could be made accessible directly through the TreeView.

As an additional bonus, it would be beneficial if the chain could be determined automatically based on the passed element.


1 Answer, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 17 Dec 2025, 03:52 PM

Hello Lukas,

Thank you for the provided details.

I have created a sample app using the Expand command and Expand method. The command uses as a parameter the text entered in an Entry, there is a placeholder how the text should be entered. Also a converter to convert the text into a item path.

The method Expand is called inside the Button.OnExpandedClick event. And the code does the following:

•	Finds the root node named Folder 1 from vm.FileSystemNodes (filters to FolderNode only with OfType<FolderNode>()).
•	From that parent’s Children, finds the child folder named Folder 2.
•	If both exist, builds the item path using identity values (strings) based on the TreeViewDescriptor.IdentityMemberPath="Name":
•	var itemPath = new object[] { parent.Name, child.Name };
•	Calls treeView.Expand(itemPath) which expands the node identified by that path.

I hope the example will be of help to get started using this functionality.

Regarding to the Expand(object dataItem) could you please review the Expand implementation I developed on a button click and let me know what is missing from the scenario you requested? In the current TreeView.Expand implementation you need to pass the itemPath. The proposed method signature from your side is the dataItem.

Regards,
Didi
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
LZI
Top achievements
Rank 1
Answers by
Didi
Telerik team
Share this question
or