3 Sep 20201 minute to read

Programmatic scrolling

Bring InTo View

The TreeView allows programmatically scrolling based on the data model and TreeViewNode by using the BringIntoView method.

It also enables and disables the scrolling animation when changing the view. By default, the scrolling will be animated.

SfTreeView treeView;
FileManagerViewModel viewModel;

protected override void OnCreate(Bundle savedInstanceState)
    // Set our view from the "main" layout resource
    treeView = FindViewById<SfTreeView>(Resource.Id.sfTreeView1);
    viewModel = new FileManagerViewModel();
    treeView.ChildPropertyName = "SubFiles";
    treeView.ItemsSource = viewModel.Folders;
    treeView.Adapter = new NodeImageAdapter();
    treeView.Loaded += TreeView_Loaded;

private void TreeView_Loaded(object sender, TreeViewLoadedEventArgs e)
    var count= viewModel.ImageNodeInfo.Count;
    var data = viewModel.ImageNodeInfo[count-1];

Scrollbar Visibility

The TreeView provides an option to enable or disable the Scrollbar visibility by using the IsScrollBarVisible property. By default, the value will be true.


Due to some restrictions in native ScrollView, you cannot change the IsScrollBarVisible value at runtime. It can be defined only when initializing the TreeView.

treeView.IsScrollBarVisible = false;