Skip to content

Commit 47ede25

Browse files
ES-975464 - Resolve the ReadMe issue in this sample repository
1 parent 7f2d0f8 commit 47ede25

File tree

1 file changed

+68
-2
lines changed

1 file changed

+68
-2
lines changed

README.md

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,68 @@
1-
# How to bring the tree node into view by scrolling in wpf treeview?
2-
This repository describes how to bring the tree node into view by scrolling in wpf treeview
1+
# How to bring the tree node into view by scrolling in WPF TreeView
2+
3+
This repository describes how to bring the tree node into view by scrolling in [WPF TreeView](https://www.syncfusion.com/wpf-controls/treeview) (SfTreeView).
4+
5+
The TreeView allows programmatic scrolling based on the data model and [TreeViewNode](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeView.Engine.TreeViewNode.html) by using the [BringIntoView](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeView.SfTreeView.html#Syncfusion_UI_Xaml_TreeView_SfTreeView_BringIntoView_Syncfusion_UI_Xaml_TreeView_Engine_TreeViewNode_System_Boolean_System_Boolean_Syncfusion_UI_Xaml_TreeView_ScrollToPosition_) method.
6+
7+
``` csharp
8+
private void BringIntoView_Click(object sender, RoutedEventArgs e)
9+
{
10+
var count = viewModel.Items.Count;
11+
var data = viewModel.Items[count - 1];
12+
sfTreeView.BringIntoView(data);
13+
}
14+
```
15+
16+
The `BringIntoView` method comprises of other optional parameters to decide on the way in which the child item should come into view.
17+
18+
### Scroll to the child item with animation
19+
20+
The second optional parameter `disableAnimation` in `BringIntoView` method decides whether the scrolling animation should be enabled or disabled when the child item comes into view. By default, the scrolling will be animated.
21+
22+
* If the parameter value is `true`, scrolling animation will be disabled.
23+
* If the parameter value is `false`, scrolling animation will be enabled.
24+
25+
``` csharp
26+
private void BringIntoView_Click(object sender, RoutedEventArgs e)
27+
{
28+
var count = viewModel.Items.Count;
29+
var data = viewModel.Items[count - 1];
30+
// Here, the second optional parameter has been passed as true hence it will disable the animation
31+
sfTreeView.BringIntoView(data, true);
32+
}
33+
```
34+
35+
### Scroll to the collapsed child item
36+
37+
The third optional parameter `canExpand` in `BringIntoView` method decides whether we need to expand and show the collapsed node or not when item passed for `BringIntoView` method which is in collapsed state. By default, this parameter value will be false.
38+
39+
* If the parameter value is `true`, TreeView expands the collapsed node if it is collapsed and scroll to the specified item.
40+
* If the parameter value is `false`, TreeView does not expand the collapsed node and only scroll for item which is not in collapsed state.
41+
42+
``` csharp
43+
private void BringIntoView_Click(object sender, RoutedEventArgs e)
44+
{
45+
var count = viewModel.Items.Count;
46+
var data = viewModel.Items[count - 1];
47+
sfTreeView.BringIntoView(data, false,true);
48+
}
49+
```
50+
51+
### Scroll the item into specified position
52+
53+
The fourth optional parameter `scrollToPosition` in `BringIntoView` method allows to position the scrolled item in the view. The scrolled item can take either of the four positions as explained below. The default position is `Start`.
54+
55+
* `Start`: Scroll to make the node positioned at the start of the view.
56+
* `MakeVisible`: Scroll to make a specified node visible in the view. If the specified node is already in view, scrolling will not occur.
57+
* `Center`: Scroll to make the node positioned at the center of the view.
58+
* `End`: Scroll to make the node positioned at the end of the view.
59+
60+
``` csharp
61+
private void BringIntoView_Click(object sender, RoutedEventArgs e)
62+
{
63+
var count = viewModel.Items.Count;
64+
var data = viewModel.Items[count - 1];
65+
// Scrolls to the data item to make visible in the view.
66+
sfTreeView.BringIntoView(data,false,true,ScrollToPosition.MakeVisible);
67+
}
68+
```

0 commit comments

Comments
 (0)