BringIndexIntoView, ScrollIntoViewAsync and ScrollIntoView

10 posts, 0 answers
  1. Alessio
    Alessio avatar
    13 posts
    Member since:
    Mar 2011

    Posted 22 Jul 2013 Link to this post

    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

     

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 24 Jul 2013 Link to this post

    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 >>
  3. DevCraft banner
  4. Alessio
    Alessio avatar
    13 posts
    Member since:
    Mar 2011

    Posted 25 Jul 2013 Link to this post

    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.
  5. Alessio
    Alessio avatar
    13 posts
    Member since:
    Mar 2011

    Posted 29 Jul 2013 Link to this post

    Do you have any suggestion?
  6. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 29 Jul 2013 Link to this post

    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 >>
  7. Alessio
    Alessio avatar
    13 posts
    Member since:
    Mar 2011

    Posted 29 Jul 2013 Link to this post

    Your code works, I found object '84' correctly. Why!?
  8. Alessio
    Alessio avatar
    13 posts
    Member since:
    Mar 2011

    Posted 29 Jul 2013 Link to this post

    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?
  9. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 29 Jul 2013 Link to this post

    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 >>
  10. Alessio
    Alessio avatar
    13 posts
    Member since:
    Mar 2011

    Posted 29 Jul 2013 Link to this post

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

  11. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 31 Jul 2013 Link to this post

    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 >>
Back to Top
DevCraft banner