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

Set SelectedNode without scrolling to node

2 Answers 56 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 29 Sep 2015, 07:28 PM

Hello:

 When I set uxTreeView.SelectedNode = someNode, if the newly selected node is out of view, the RadTreeView control is scrolled so that the newly selected node is in view and visible.  How do I prevent the scroll from occurring?  I want to select a node that may be out of view, but don't want the node to be scrolled into view.

 Thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 30 Sep 2015, 11:11 AM
Hi Mark,

Thank you for contacting us.

You can save and restore the scroll position with the following code:
void radButton1_Click(object sender, EventArgs e)
{
    int scrollValue = radTreeView1.TreeViewElement.VScrollBar.Value;
    radTreeView1.SelectedNode = radTreeView1.Nodes[55];
    radTreeView1.TreeViewElement.VScrollBar.Value = scrollValue;
}

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Mark
Top achievements
Rank 1
answered on 30 Sep 2015, 05:57 PM
Worked like a charm.  Thanks, Dimitar!
Tags
Treeview
Asked by
Mark
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Mark
Top achievements
Rank 1
Share this question
or