Bug? ScrollIntoView doesn't look upwards

10 posts, 0 answers
  1. Oleg
    Oleg avatar
    6 posts
    Member since:
    Mar 2011

    Posted 24 Jan 2012 Link to this post

    Hello,

    Looks like ScrollIntoView doesn't do anything if the grid is scrolled down to the bottom and the item to be displayed is at the top (out of view). Is it a bug or I've messed something up in my project?

    Regards,
    Oleg

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 25 Jan 2012 Link to this post

    Hi,

     I have tested such a scenario and the GridView was scrolled up right to the item displayed at the top.
    According to this thread you use the 2011.3.1220 version of the RadControls. Can you please confirm that?
     

    All the best,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Oleg
    Oleg avatar
    6 posts
    Member since:
    Mar 2011

    Posted 25 Jan 2012 Link to this post

    Didie, that's right, I'm using version 2011.3.1220. If you say it should work then I'll have to build a sample project. I'm actually observing a bunch of issues related to virtualization and paging and I thought scrolling was one of them.
  4. Sebastian
    Sebastian avatar
    9 posts
    Member since:
    Mar 2012

    Posted 29 Mar 2012 Link to this post

    Hi,

    I am actually having some issues with scrolling upwards with the ScrollIntoViewAsync.
    It works if the item I am trying to scroll to is out of view considerably but not when it is only 10 rows out of sight.

    This means that I am getting a gap in the scrolling function upwards, however downwards it works fine.

    Any advice setting some properties like Height on the grid for instance?
    I am using Telerik version 2012.1.0215.1040.

    Please advice.

    Regards,
    Sebastian
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 30 Mar 2012 Link to this post

    Hi,

     I have tested scrolling to an item upwards. The item was brought into view.

    When I read through your text, I am not sure that I understand this line "gap in the scrolling function upwards". Would you please show me a screenshot or send me a small test project to illustrate this "gap"?  

    Kind regards,
    Didie
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. Sebastian
    Sebastian avatar
    9 posts
    Member since:
    Mar 2012

    Posted 10 Apr 2012 Link to this post

    Hi,

    The "gap" I am referring to is the items in the middle are the rows that the ScrollIntoViewAsync method will consider as in view while they are not visible in the UI.

    I tracked my problem down to the following method:
    IScrollContentElement.IsInViewport

    Which returns true even when the item is not showing.

    I choose to go with another solution since I also need the item that is being scrolledintoview to be centered in the UI.
    var focusElement = GetElementToScrollTo();
    var datarow = focusElement.ParentOfType<Telerik.Windows.Controls.GridView.GridViewRow>();
    var scrollBar = grid.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault();
     
    double gridCenter = grid.ActualHeight / 2;
    var transform = focusElement.TransformToVisual(grid as UIElement);
    var myUiElementPosition = transform.Transform(new Point(0, 0));
     
    double scrollAmount = myUiElementPosition.Y - gridCenter;
    //Debug.WriteLine("Diff from center:" + scrollAmount.ToString());
    //Debug.WriteLine("Scrolling to:" + (scrollBar.VerticalOffset + scrollAmount).ToString());
    scrollBar.ScrollToVerticalOffset(scrollBar.VerticalOffset + scrollAmount);

    Hope that could help someone else.

    //Sebastian
  7. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 12 Apr 2012 Link to this post

    Hi,

    I am glad to hear that you have found a solution for your case.

     I am still not able to scroll the item out of View. Could you please attach a screenshot describing the "gap"? 

    All the best,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  8. Christophe
    Christophe avatar
    2 posts
    Member since:
    Sep 2012

    Posted 19 Dec 2012 Link to this post

    Hi,

    I have the same problem and noticed all the behaviors described by Sebastian. I use version 2012.1.326 and EnableRowVirtualization is false. My grid is embeded in a RadPane docked at the bottom of my app and I noticed that the gap (described by Sebastian) is smaller when my pane/grid is smaller. The gap is approximately equal to the height of the grid (a little smaller).

    Have you found a solution yet other than the one provided by Sebastian?

    Christophe
  9. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 21 Dec 2012 Link to this post

    Hello,

    Do you meet the same problem when the GridView is not embedded in a RadPane? Have you also tested with our most recent version - 2012 Q3 SP? If you can still reproduce the problem, then may I ask you to please open a support ticket sending us a demo project showing the exact case you have?

    Regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  10. Christophe
    Christophe avatar
    2 posts
    Member since:
    Sep 2012

    Posted 21 Dec 2012 Link to this post

    It works with version 2012 Q3. Thank you.
Back to Top