Bring TreeItem into view with horizontal scroll?

2 posts, 0 answers
  1. Buzz
    Buzz avatar
    32 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?

    Thanks
    Buzz
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 03 Apr 2012 Link to this post

    Hi,

     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,"|");
           container.BringIntoView();
           this.treeViewDepartments.ScrollViewer.ScrollToHorizontalOffset(this.treeViewDepartments.ItemsIndent * (container.Level + 1));
         }

    Please let us know if this is suitable for you.

    Regards,
    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top