Hello Yu,
I am not sure I understand you first requirement - highlight the parent node that contains the specific child node. Can you please elaborate more on it? Is the node that you're bringing into view also the selected node? Or you have a selected item and you need to bring into view another item?
If your scenario is to have a selected item and then bring another item into view without selecting it but highlighting its parent item, then you can follow the approach in the blog post but without selected the item that is brought into view. Basically in the blog post solution you need to modify the
BringItem method like so:
Please note that the item that will be brought into view isn't selected - its
IsSelected property isn't changed and that we use the
RadTreeView.ContainerFromItemRecursive method to get the
RadTreeViewItem container of the parent item to change its background.
Also, when you set the
SelectedItem property when loading the
RadTreeView control the
SelectionChanged and
PreviewSelectionChanged events are fired so if you want to handle the selection or implement a custom logic based on it, these are the events that you need to handle.
I hope this information will help you. Please let us know if we can further assist you.
Greetings,
Tina Stancheva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>