Stopping the RadTreeView autoscrolling horizontally on expand all

2 posts, 0 answers
  1. Andrew
    Andrew avatar
    37 posts
    Member since:
    Dec 2012

    Posted 20 Oct 2015 Link to this post

    I have a RadTreeView that I am binding to some data.

    I would like to have all the items in the tree expanded by default.

    The issue I have when I do this is that the tree is autoscrolling to the right to bring into focus the most right hand expanded item.

    To try and get round this I have disabled the horizontal scroll bar, call ExpandAll(), then after that reenable the horizontal scroll bar.

    This is not working.

    private void FrameworkElement_OnLoaded(object sender, RoutedEventArgs e)
            {
                RadTreeView rtv = sender as RadTreeView;
     
                if (rtv.ScrollViewer != null)
                {
     
                    rtv.ScrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
     
                    rtv.ExpandAll();
     
                    rtv.ScrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
                }
            }

    Please can you advise on the correct way to achieve this?

     Thanks.

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 23 Oct 2015 Link to this post

    Hello Andrew,

    We were not able to reproduce this in our environment. Could you please check out our testproject - databound, tree, 3 levels, the last items in the third levels are selected ? On ExpandAll, the horizontal scrollviewer is not moved to right. 
    However, we are not exactly sure what is your setup. Could you please elaborate a bit more on your scenario ?
    - your telerik version
    - databound or not TreeView ?
    - is there selection in the tree before the Expansion ?
    - Does setting AutoScrollToSelectedItem="False"  has any effect ?

    Regards,
    Petar Mladenov
    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 WPF is Visual Studio 2017 Ready
Back to Top