locked
Scroll gridview into first item RRS feed

  • Question

  • I need to scroll the gridview's scrollbar into starting point how I can achieve it?

    gridview is virtualized so the following code not working it throws a element not found exception

    ItemGridView.ScrollIntoView(ItemGridView.Items[0]);


    Santana George

    Thursday, April 25, 2013 6:49 AM

Answers

  • Maybe... grab the scrollviewer of the gridview, and use the scroll to offset method?


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, April 25, 2013 2:48 PM
    Moderator
  • var scrollViewer = page.ItemGridView.GetFirstDescendantOfType<ScrollViewer>();
                                    scrollViewer.ScrollToHorizontalOffset(0);

    Thanks

    Santana George

    Thursday, April 25, 2013 4:55 PM

All replies

  • Maybe... grab the scrollviewer of the gridview, and use the scroll to offset method?


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, April 25, 2013 2:48 PM
    Moderator
  • var scrollViewer = page.ItemGridView.GetFirstDescendantOfType<ScrollViewer>();
                                    scrollViewer.ScrollToHorizontalOffset(0);

    Thanks

    Santana George

    Thursday, April 25, 2013 4:55 PM