Articles in this section
Category / Section

How to autoscroll for viewing a newly added item in TreeViewAdv control

1 min read

This article describes How to autoscroll for viewing a newly added item in TreeViewAdv control.

BringIntoView

Use BringIntoView method of TreeViewAdv control to scroll and view a particular item.

Use Button Click event to add items to TreeViewItemAdv of TreeViewAdv control.

The following code demonstrates the same by passing newly added item as argument to BringIntoView method.

 

XAML

<syncfusion:TreeViewAdv Name="tree">
            <syncfusion:TreeViewItemAdv Header="Parent Tree" FontSize="18">
            </syncfusion:TreeViewItemAdv>
</syncfusion:TreeViewAdv>
<Button Grid.Column="1"  HorizontalAlignment="Center" Height="40" Width="100" FontSize="18" Click="ButtonClick">
      Click here
</Button>

 

C#

private void ButtonClick(object sender, EventArgs e)
        {
                TreeViewItemAdv treeitem =new TreeViewItemAdv();
                treeitem.Header = "Tree"+ ((tree.Items[0] as TreeViewItemAdv).Items.Count + 1).ToString();
                (tree.Items[0] as TreeViewItemAdv).Items.Add(treeitem);
                tree.BringIntoView(treeitem);
        }

 

The output for the above code is shown below:

 

 

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied