Hi,
I think I've tried every possible solution to get this working but for some reason I can't.
Binding on IsSelected property in RadTreeViewItem is not an option.
Using the ContainerFromItemRecursive method I am able to get container of a root item, but when trying to get container of an item that is not root I get null value.
Here is the code block I'm using for this:
Method FindItemInDataSource works fine and I get the entity I want selected, but ContainerFromItemRecursive method returns null in every case except if item is a root element of a treeview.
Am I doing something wrong or this is just another issue with one of your controls.
Thank you in advance,
Zarko
I think I've tried every possible solution to get this working but for some reason I can't.
Binding on IsSelected property in RadTreeViewItem is not an option.
Using the ContainerFromItemRecursive method I am able to get container of a root item, but when trying to get container of an item that is not root I get null value.
Here is the code block I'm using for this:
void ItemContainerGenerator_StatusChanged(object sender, EventArgs e) |
{ |
if (TreeViewMain.ItemContainerGenerator.Status == Telerik.Windows.Controls.Primitives.GeneratorStatus.ContainersGenerated) |
{ |
// compares items in TreeViewMain.ItemsSource and _selectedItem and returns object from TreeViewMain.ItemsSource |
// that has the same type and id as _selectedItem |
Object item = FindItemInDataSource((IEnumerable)TreeViewMain.ItemsSource, _selectedItem); |
RadTreeViewItem radItem = TreeViewMain.ContainerFromItemRecursive(item); |
if (null != radItem) |
{ |
radItem.IsSelected = true; |
} |
} |
} |
Method FindItemInDataSource works fine and I get the entity I want selected, but ContainerFromItemRecursive method returns null in every case except if item is a root element of a treeview.
Am I doing something wrong or this is just another issue with one of your controls.
Thank you in advance,
Zarko