Please accept my apology for the delayed response.
In order to bring the expanded item to the top of the RadTreeView
and display as many as possible of its children as possible, you can get the coordinates of the expanded item and scroll the RadTreeView
to display this coordinates at the top. In order to do so, you'll need to transform the coordinates of the expanded RadTreeViewItem
into the RadTreeView
Point p = item.TransformToVisual(tree).Transform(
tree.ScrollViewer.ScrollToVerticalOffset(tree.ScrollViewer.VerticalOffset + p.Y);
and scroll to it.
I attached a sample solution demonstrating this approach. However, please note that I have disabled the RadTreeView
animations as they delay the RadTreeView.ScrollViewer
calculations. When you turn them on, the ScrollToVerticalOffset()
logic will be executed before the ScrollViewer
can fully calculate the real Height of the RadTreeView
as the animations delay the realization of the RadTreeViewItem
This is why if you have to turn the animations on, it's best to create custom animations and attach a behavior that will fire the tree.ScrollViewer.ScrollToVerticalOffset()
logic after the animations are over. And in this case you should consider applying an animation for the scrolling logic as well to make it more fluent.
All the best,
the Telerik team