How to set the ListView.scrollPosition property? RRS feed

  • Question

  • Hi,

    I have a ListView and I save the scrollPosition (number of pixels) to sesion state when an item is invoked. Now I'd like to be able to return to the same position when the user navigates back. I put the following code inside "ready" function, at the end:

    msSetImmediate(function () {
                    if (session.homeIndex !== undefined) {
                        listView.scrollPosition = session.homeIndex;

    Unfortunately the listView.scrollPosition is always 0 after the set operation even though session.homeIndex contains the right value (I see in the debugger).

    Using ensureVisible works but it's not what I want. I need to return to a precise position.

    Any help will be appreciated :) Thanks!


    Monday, August 13, 2012 2:20 PM


All replies