How can I help you?
Scrolling
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;
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Perform any additional setup after loading the view
SfTreeView treeView = new SfTreeView(View.Bounds);
viewModel = new FileManagerViewModel();
treeView.ChildPropertyName = "SubFiles";
treeView.ItemsSource = viewModel.Folders;
treeView.Adapter = new NodeImageAdapter();
treeView.Loaded += TreeView_Loaded;
Add(treeView);
}
private void TreeView_Loaded(object sender, TreeViewLoadedEventArgs e)
{
var count= viewModel.ImageNodeInfo.Count;
var data = viewModel.ImageNodeInfo[count-1];
treeView.BringIntoView(data);
}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.
NOTE
Due to some restrictions in native ScrollView, you cannot change the
IsScrollBarVisiblevalue at runtime. It can be defined only when initializing the TreeView.
treeView.IsScrollBarVisible = false;