If the ContainerFromItemRecursive()
method returns null that means that either the item isn't in the ItemsSource of the RadTreeView
or the containers aren't yet generated.
Basically you need to keep in mind that this method can only be used when the RadTreeView
has finished generating the containers for the business items. You can handle the ItemContainerGenerator.StatusChanged
event to get the container of an item only if the status of the ItemContainerGenerator
sender, EventArgs e)
Telerik.Windows.Controls.ItemContainerGenerator).Status == Telerik.Windows.Controls.Primitives.GeneratorStatus.ContainersGenerated)
RadTreeViewItem childContainer = treeView.ContainerFromItemRecursive(child);
However, as I am not sure how you use the ContainerFromItemRecursive()
method, I am not sure what is causing your issues. But if you can send us a sample demonstrating your scenario, we'll be able to further investigate your case.
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>