This is a migrated thread and some comments may be shown as answers.

BringIndexIntoView, ScrollIntoViewAsync and ScrollIntoView

9 Answers 237 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Alessio
Top achievements
Rank 1
Alessio asked on 22 Jul 2013, 09:19 AM

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

Sort by
0
Dimitrina
Telerik team
answered on 24 Jul 2013, 09:08 AM
Hi,

I am not sure how the ScrollIntoViewAsync fails. Would you please share how you know it fails and how have you invoked this method?
 

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
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 >>
0
Alessio
Top achievements
Rank 1
answered on 25 Jul 2013, 08:46 AM
thanks for the answer.
Please find the VS Solution at this link: Would you kindly review it and let me know whether I miss something?

Regards.
0
Alessio
Top achievements
Rank 1
answered on 29 Jul 2013, 10:13 AM
Do you have any suggestion?
0
Dimitrina
Telerik team
answered on 29 Jul 2013, 11:50 AM
Hi,

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
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
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 >>
0
Alessio
Top achievements
Rank 1
answered on 29 Jul 2013, 12:11 PM
Your code works, I found object '84' correctly. Why!?
0
Alessio
Top achievements
Rank 1
answered on 29 Jul 2013, 12:26 PM
Ok, if I find item on ItemsSource, ScrollIntoViewAsync 'scrolls' correctly! Thanks :)

Well, I'd like to scroll to bring row on center of grid, what can I do for that?
0
Dimitrina
Telerik team
answered on 29 Jul 2013, 02:00 PM
Hello,

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.

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
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 >>
0
Alessio
Top achievements
Rank 1
answered on 29 Jul 2013, 03:13 PM

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);

0
Dimitrina
Telerik team
answered on 31 Jul 2013, 09:16 AM
Hello,

You can check this forum thread where a similar question has been discussed.

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
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 >>
Tags
TreeListView
Asked by
Alessio
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Alessio
Top achievements
Rank 1
Share this question
or