Using BringIntoView

3 posts, 0 answers
  1. Ed
    Ed avatar
    10 posts
    Member since:
    Jan 2012

    Posted 05 Jul 2012 Link to this post


    I am trying to bring the selected item into view programmatically. This is used during initial population of the tree. The item's ancestors are expanded, and then the item itself is selected by setting the property which is bound to SelectedItem in the RadTreeView. Finally, the RadTreeView's SelectionChanged event is handled as follows:

    private void RadTreeView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        RadTreeViewItem item = radTreeView.SelectedContainer;
        if (item != null)

    The expansion and selection works correctly, and the code above is fired after selection, and it identifies the correct item to bring into view - except that it does not bring it into view. The scroll bar remains at the top.

    In case of use, here is the XAML that we've used to define the RadTreeView:

    <Grid x:Name="LayoutRoot">
            <RowDefinition />
            <RowDefinition Height="Auto" />
        <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
            <telerik:RadTreeView Name="radTreeView" ItemTemplate="{StaticResource LocationTemplate}"
                                 ItemsSource="{Binding Path=LocationRoot}"
                                 SelectedItem="{Binding Path=SelectedLocation, Mode=TwoWay}"
        <!-- etc. -->

    I also notice that if I click on an item that is only partially in view, the code above does not bring it fully into view. This isn't a problem for us but maybe it indicates a problem with the code above.

    Your help is appreciated - thanks very much.

  2. Ed
    Ed avatar
    10 posts
    Member since:
    Jan 2012

    Posted 05 Jul 2012 Link to this post

    Hi again,

    I solved the problem by removing the ScrollViewer from the XAML, which allows the RadTreeView to use its own scroll viewer. Oops!

    My only tiny complaint is that the Telerik scroll bars look different from the standard Silverlight scroll bars. Because we have another region on the same page that uses a standard scroll bar, it looks slightly odd. Is there any way to style the Telerik scroll bar to look like the standard?

    Thanks a lot

  3. Hristo
    Hristo avatar
    352 posts

    Posted 10 Jul 2012 Link to this post


    I'm glad you have solved the issue.

    Regarding the scroll bars, you could set the appropriate style to the scroll viewer inside RadTreeView control template. The following link explains how to edit the TreeView style using expression blend: .
    This link provide a bit of information about the TreeView template structure: .

    All the best,
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top