Hi,
I have total 400 rows and 3 nested items every 5 elements, I can auto scroll to specific row using ScrollIndexIntoViewAsync only after I call ExpandAllHierarchyItems but with this I have also some performance delay.
I need to find an element and expand that, with:
RadTreeViewItem item = RadTreeListView1.ItemContainerGenerator.ContainerFromItem(obj) as RadTreeViewItem;
ScrollIntoViewAsync fails but scrollFailedCallback don't it raised.
What can I do?
Thanks
9 Answers, 1 is accepted
I am not sure how the ScrollIntoViewAsync fails. Would you please share how you know it fails and how have you invoked this method?
Didie
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
I started the project, I clicked the Scroll button and nothing happened. It is because you try to scroll to an item that does not exist in the Items collection of the RadTreeListView.
Please pass an item to scroll to similar to:
private
void
ButtonBase_OnClick(
object
sender, System.Windows.RoutedEventArgs e)
{
var collection =RadTreeListView1.ItemsSource as ObservableCollection<BaseEvent>; var item = collection.Where(x=>x.Id == 84).First();
...
}
Let me know how this works for you.
Regards,
Didie
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Well, I'd like to scroll to bring row on center of grid, what can I do for that?
My code works, because I scroll to an item that is presented in the Items collection of the TreeListView. In your implementation you were trying to scroll to an item that does not exist in that collection.
There is not an API to scroll an item to a particular position on the screen. We can only assure that the item will be brought into view.
Didie
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Is it possible to khow the position of TreeListRow to top of GridViewScrollViewer?
this.RadTreeListView1.ScrollIntoViewAsync(item, (tt) => {
Debug.WriteLine(string.Format("found AutocenterMessage - {0}", t.Item.Index));
var scroller = this.RadTreeListView1.ChildrenOfType<GridViewScrollViewer>().First();
var b = scroller.ViewportHeight / 2;
var a = scroller.VerticalOffset;
var e = b + a;
Debug.WriteLine(string.Format("***** a - {0}", a));
Debug.WriteLine(string.Format("***** b - {0}", b));
Debug.WriteLine(string.Format("***** b+a - {0}", e));
GeneralTransform trsf = tt.TransformToVisual(scroller);
Point pointToMove = trsf.Transform(new Point(0, 0));
Debug.WriteLine(string.Format("***** pointToMove - {0}", pointToMove));
scroller.ScrollToVerticalOffset(e);
}, () => {
Debug.WriteLine(string.Format("NOT found AutocenterMessage - {0}", t.Item.Index));
}, true);
You can check this forum thread where a similar question has been discussed.
Regards,Didie
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>