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

[Solved] Emulating page up/down (or adding it natively)

5 Answers 53 Views
Grid for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Roger
Top achievements
Rank 1
Roger asked on 17 Jun 2013, 08:38 PM
Our users want a page up/page down button on the screen that they can tap to page up/down the grid. This is useful for them as they quickly memorize how many page downs it takes to get to a certain row for example.

Right now it is tough to implement this sort of thing as there is no access to the current scroll position to adjust. The only options are to scroll an item (or index) into view. I have wired up my own page up/down buttons which just adjust an index I am manually keeping track of. The problem with this approach is that if the user scrolls the grid themselves, then I have no idea to factor that in as I am keeping track of the scroll index myself.

Normally I would just get the current scroll position, and adjust it by the height of the window - but like I said there is no way to get/set the current scroll position. Another route would be to get the first item that is visible in the grid and scroll an index into view relative to that item's position, but I don't see a way to do that either.

Thanks for any suggestions! If there's any change to add in built in page up/down functionality to the grid itself that would be nice too.

5 Answers, 1 is accepted

Sort by
0
Roger
Top achievements
Rank 1
answered on 18 Jun 2013, 02:54 PM
Just to simplify this request - can we please have access to get/set the scroll position of the grid view? That's really all I need.

Thanks!
0
Ivaylo Gergov
Telerik team
answered on 19 Jun 2013, 03:40 PM
Hi Roger,

Thank you for your question.

Yes, at this point the RadDataGrid does not expose the scroll position and I cannot suggest a possible solution. However, this is a common scenario and we will do our best to provide suitable API as soon as possible.

If you have any other questions or suggestions do not hesitate to contact us again. Also, I have updated your Telerik points for the valuable feedback.

Regards,
Ivaylo Gergov
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Roger
Top achievements
Rank 1
answered on 23 Jul 2013, 01:22 PM
Is there any time table for this yet by chance? Just opening up access to the scrollview position would help us out a ton. Right now we have a temporary solution using ScrollItemIntoView(), but it really isn't cutting it for a lot of page up/down use.

Thanks!
0
Ivaylo Gergov
Telerik team
answered on 25 Jul 2013, 12:56 PM
Hello Roger,

I have forwarded your request to our development team and they have raised its priority. We will do our best to implement this functionality for our next official release - that is Q3 2013.

I hope this information is useful.

Regards,
Ivaylo Gergov
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Roger
Top achievements
Rank 1
answered on 11 Sep 2013, 12:39 PM
I ended up finding a way to do this in the short-term, figured I'd share for anyone else.

Create a property for accessing the internal ScrollViewer - you will need to get the WinRTXamlToolkit for VisualTreeHelperExtensions:
private ScrollViewer _gridScrollViewer;
private ScrollViewer GridScrollViewer
{
    get
    {
        if (_gridScrollViewer == null)
        {
            var scrollViewers = ProductGrid.GetDescendantsOfType<ScrollViewer>();
            if (!scrollViewers.Any())
            {
                LogCritical("Could not find scroll viewer!");
                return null;
            }
 
            _gridScrollViewer = scrollViewers.First();
        }
 
        return _gridScrollViewer;
    }
}

Wire up event handlers
private void PageDownButton_Tapped(object sender, TappedRoutedEventArgs e)
{
    if (GridScrollViewer != null)
    {
        var posY = GridScrollViewer.VerticalOffset + GridScrollViewer.ViewportHeight;
        posY = Math.Min(posY, GridScrollViewer.ScrollableHeight); // make sure it's no larger than the scrollable height available
        GridScrollViewer.ScrollToVerticalOffset(posY);
        return;
    }
}
 
private void PageUpButton_Tapped(object sender, TappedRoutedEventArgs e)
{
    if (GridScrollViewer != null)
    {
        var posY = GridScrollViewer.VerticalOffset - GridScrollViewer.ViewportHeight;
        posY = Math.Max(0, posY); // make sure it is at least 0
        GridScrollViewer.ScrollToVerticalOffset(posY);
        return;
    }
}
Tags
Grid for XAML
Asked by
Roger
Top achievements
Rank 1
Answers by
Roger
Top achievements
Rank 1
Ivaylo Gergov
Telerik team
Share this question
or