Set SelectedNode without scrolling to node

3 posts, 1 answers
  1. Mark
    Mark avatar
    7 posts
    Member since:
    Mar 2015

    Posted 29 Sep 2015 Link to this post

    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. Answer
    Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 30 Sep 2015 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Mark
    Mark avatar
    7 posts
    Member since:
    Mar 2015

    Posted 30 Sep 2015 in reply to Dimitar Link to this post

    Worked like a charm.  Thanks, Dimitar!
Back to Top