Expanding / Selecting a particular item a RadTreeView in code can be achieved with GetItemByPath
() / BringPathIntoView
() / SelectitemByPath() / ExpandItemByPath() methods which are very similar. Generally, if you organize your ViewModels to provide a Path property (or method) you can access (or select/expand) a particular RadTreeViewItem (the container for the viewmodel) with these functions.
In your scenario, it is important whether the same (or some of the) viewmodels (objects) reside in multiple RadTreeView instances. If an object is both in trees A B and C, you need the paths for this object for every tree. You can store such paths, for example in dictionary per tree or in dictionary per object. Once such object is selected/expanded via its container (RadTreeViewItem) in tree A, you can use the Expanded / SelectionChanged event, get this object , and expand/select/bring this object in the other trees, having its path available. Also, if you two-way bind the IsSelected property
of the RadTreeViewItem to some boolean property of the object (viewModel), the object will be selected in all trees.
If your trees use entirely different sets of objects , you need to have matching dictionary - or way to say that object x in tree A matches the object y in tree B. Then use the same approach - when expand / select the first, get the matching second object and use its path in combination with the get-item-by-path functions.
Regarding the alternation colors, this can be achieved with ItemContainerStyleSelector
- just select different template / style based on the index of the given object.
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer
and share your thoughts.