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

Stopping the RadTreeView autoscrolling horizontally on expand all

1 Answer 139 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 20 Oct 2015, 09:08 AM

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.

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 23 Oct 2015, 08:27 AM
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
Tags
TreeView
Asked by
Andrew
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or