This is a migrated thread and some comments may be shown as answers.

Bummer - tree view scrolls back to the top

1 Answer 118 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 07 Nov 2008, 05:43 PM
I have a scenario that's driving me nuts and I'm trying to figure out if the problem I'm having is a bug in the treeview control or if there's a workaround I can use:

I have a treeview in a split container.  Whenever the splitter is moved, the treeview scrolls back to the top.

The scenario is this: I have a treeview in the top of the splitter and a panel in the bottom of the splitter.  When the user hovers over a node in the treeview, I fill in information about the node in the panel at the bottom.  It's kinda like a super tooltip.  The key issue is that I want the panel at the bottom to only take as much space as needed, so I move the splitter programmatically so there is no wasted space in the bottom of the splitter and the maximum amount of the tree view is visible. So, when the splitter gets moved (in this case, programmatically) to treeview scroll position resets to the top.



1 Answer, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 10 Nov 2008, 08:59 AM
Hello David,

Indeed, at the moment when the RadTreeView control is resized its scroll position is reset to 0, which is not very intuitive. This behavior will be corrected for our next release.

For now you can use the following workaround: save the old scroll position, change the splitter position, then restore the scroll position:

 this.radTreeView1.BeginUpdate(); 
            int scrollBarValue = this.radTreeView1.VScrollBar.Value; 
 
            this.splitContainer1.SplitterDistance = 500; 
 
            this.radTreeView1.VScrollBar.Value = scrollBarValue; 
            this.radTreeView1.EndUpdate(); 

Sorry for the introduced inconvenience.

Kind regards,
Jordan
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Treeview
Asked by
David
Top achievements
Rank 1
Answers by
Jordan
Telerik team
Share this question
or