locked
About FlipView in Metro

    Question

  • I want to show the current page displayed; but I haven't found an effective method, since the pageselected and pagevisibilitychanged event  don't offer the proper value when swipped on it. Please someone knowing this tell me, thanks!
    Monday, February 13, 2012 9:53 AM

All replies

  • Hi Roney,

    I do not understand what your question is.  Could you provide some more details about the problem you are having?

    -Jeff


    Jeff Sanders (MSFT)

    Monday, February 13, 2012 2:21 PM
    Moderator
  • I think he wants something like:
    Page #: <span id="pageNum"></span>

    Attach this event to the FlipView. This will be fired once the flip is complete:

    var flipView = WinJS.UI.getControl(document.getElementById("YourFlipView"));
          flipView.addEventListener("pageselected", FlipPagesSelected);

    Event:

    function FlipPagesSelected(eventinfo) { var page = document.getElementById("pageNum"); var flipView = WinJS.UI.getControl(document.getElementById("CategoryFlipView")); page.innerHtml = flipView.currentPage; }

    That's it. A tiny bit ugly, the eventinfo coming into the FlipPagesSelected might have the FlipView in it to get the currentPage, so you might not have to do a getElementById on the FlipView in my example. But it's a good start I think.

    • Edited by Harlequin Monday, February 13, 2012 3:45 PM Add spacing.
    Monday, February 13, 2012 3:45 PM
  • Yes, I've done this like Harlequin, but the problem is that, if the user just flips, although the page showed has been changed, sometimes the "pageselected" doesn't fire, I've tested in the pad gotten from MS, somebody could have a try.
    Friday, February 17, 2012 3:08 AM