Bring TreeItem into view with horizontal scroll?

2 posts, 0 answers
  1. Buzz
    Buzz avatar
    36 posts
    Member since:
    Oct 2010

    Posted 29 Mar 2012 Link to this post

    BringPathIntoView vertically scrolls my treeview so the end path item is "in view", however the item is hidden to the right because the treeview is in a narrow container.  How can I get the treeview to auto scroll horizontally over so the item is truly in view?

  2. Petar Mladenov
    Petar Mladenov avatar
    3155 posts

    Posted 03 Apr 2012 Link to this post


     I guess you mean that you cannot see the whole RadTreeViewItem. In order to workaround this, you can scroll the ScrollViewer of the tree horizontally like so:

    private void Button_Click(object sender, RoutedEventArgs e)
           RadTreeViewItem container =  this.treeViewDepartments.GetItemByPath(this.bringPathBox.Text,"|");
           this.treeViewDepartments.ScrollViewer.ScrollToHorizontalOffset(this.treeViewDepartments.ItemsIndent * (container.Level + 1));

    Please let us know if this is suitable for you.

    Petar Mladenov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top