locked
ListView position after back button

    Question

  • we saw that the Microsoft Store app did something really nice.  Let's say user scrolls the list and click on one of the item.  Then user click back button to come back.  The user will come back to the position where he was.  We are just wondering how the Store app implements this?  

    This sounds like something the library would already support.  Do you know if it is supported by the control library already?  We found the following forum post, but does not quite seem to answer the question.  

    Friday, August 31, 2012 8:48 AM

Answers

  • looking at listview, there is a
    indexOfFirstVisible 
     property.  Get and set this property seems to work for me.
    • Edited by w-p Saturday, September 01, 2012 3:29 AM
    • Marked as answer by w-p Saturday, September 01, 2012 3:33 AM
    Saturday, September 01, 2012 1:37 AM
  • Sure, you can ask the WinJS listview for its scroll position at listView.scrollPosition
    • Marked as answer by w-p Saturday, September 01, 2012 3:33 AM
    Friday, August 31, 2012 10:41 AM

All replies

  • I found the easiest way to implement the behaviour you describe in our app was to open the new page in an overlayed div, and then change the back button behaviour to remove the div rather than navigate back. YMMV
    Friday, August 31, 2012 9:21 AM
  • Sure, you can ask the WinJS listview for its scroll position at listView.scrollPosition
    • Marked as answer by w-p Saturday, September 01, 2012 3:33 AM
    Friday, August 31, 2012 10:41 AM
  • interesting idea.  that should work.
    Saturday, September 01, 2012 1:23 AM
  • Thanks for answering.  

    I tried get and set scrollPosition.

    Somehow, when setting scrollPosition, the position it set to is always off from the original position?


    Saturday, September 01, 2012 1:24 AM
  • looking at listview, there is a
    indexOfFirstVisible 
     property.  Get and set this property seems to work for me.
    • Edited by w-p Saturday, September 01, 2012 3:29 AM
    • Marked as answer by w-p Saturday, September 01, 2012 3:33 AM
    Saturday, September 01, 2012 1:37 AM