3 Answers, 1 is accepted
0
Hello Robert,
Petar Mladenov
the Telerik team
If you need to scroll to the item you've got by the GetItemByPath, you better use the BringPathintoViewMethod() which performs these two tasks:
1) Generates the containers needed along the path to the given item
2) Brings the item into view (expanding and scrolling to the item).
Please check out the following help article and let us know how it goes.
Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
robert
Top achievements
Rank 1
answered on 02 Oct 2012, 12:25 PM
Thank you for your help. When i use BringPathIntoView the node is expanded and shown as last entry (vertical) of the treeview window. I want that the item is shown in the middle of the treeview window (when enough notes behind are available) not on last position, i. e. verticaloffset node position + 500. How can i do this?
Please see attached screenshots.
Thank you ...
Please see attached screenshots.
Thank you ...
0
Hi Robert,
which will scroll so that the child items of the brought item will be visible.
When it has no children , you have to perform this scrolling on your own, and this is not so easy, because you need to wait for the Bring operation to finish. You can try with Dispatcher like so:
This is also demonstrated in the attached project.
Greetings,
Petar Mladenov
the Telerik team
When the item in question has children , you can set the RadtreeView's property BringIntoViewModel to "HeaderAndItems";
<
telerik:RadTreeView
x:Name
=
"treeView"
PathSeparator
=
"|"
BringIntoViewMode
=
"HeaderAndItems"
>
When it has no children , you have to perform this scrolling on your own, and this is not so easy, because you need to wait for the Bring operation to finish. You can try with Dispatcher like so:
private
void
Button_Click_1(
object
sender, RoutedEventArgs e)
{
this
.treeView.BringPathIntoView(
"Item 2|Item 2.1|Item 2.1.3"
);
RadTreeViewItem container =
this
.treeView.GetItemByPath(
"Item 2|Item 2.1|Item 2.1.3"
);
container.IsSelected =
true
;
Dispatcher.BeginInvoke(
new
Action(()=>
{
this
.treeView.ScrollViewer.ScrollToVerticalOffset(
this
.treeView.ScrollViewer.VerticalOffset +
this
.treeView.ScrollViewer.ViewportHeight/2);
}), DispatcherPriority.ApplicationIdle);
}
Greetings,
Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.