Two way Binding to TreeNode properties

1 Answer 40 Views
TreeView
Andrew
Top achievements
Rank 1
Iron
Iron
Andrew asked on 26 Feb 2022, 11:35 PM

Depending if my folder is expanded or not I may want to display a different icon. Or I might want one of my leaf tree nodes should show a different look because of an external state change (e.g. IsDirty so add an asterisk to the text and make it red.)

Changing the bound IconClass property of the tree node doesn't update the tree.

If I update the property, I can't find a way to tell the tree to re-render that node.

My only working example is to reset the tree data with a new copy of the tree data list. However this looks very awkward in the example of a tree node expand/collapse. The node expands and then about a second later the icon changes to an open folder.

Any other options available?

-Andy

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 02 Mar 2022, 08:03 AM

Hi Andrew,

Your observation is correct and refreshing the data instance is the current way to go.

There is a feature request to track TreeView item property changes, which can provide different options in such scenarios, depending on how exactly we implement it.

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