locked
FlipView-Item swipe navigation for pages

    Question

  • Hi everyone.

    In my projekt i have several pages witch i today navigate through with an Manipulation-Started, Delta events that checks if im sliding far enough.
    If that is the case im using "this.Frame.Navigate(typeof(anotherPage);", almost like FlipView sliding through items.

    It kinda works, but if the page im using this function in has an ScrollViewer in it witch have other handlers in it, my function no longer works that well...

    Im wondering if there is a solution to my problem?

    Is it possible to have an FlipView and  the items is loaded pages???

    Friday, April 12, 2013 1:06 PM

Answers

  • Well, ListView.Items.Item is defined as Object, so theoretically it's theoretically possible, but you're going to have to work really hard to convince me that it's a good idea.

    • You'd have to instantiate every Page in order to add them to the collection.
    • It's not going to solve (or even address) your ScrollViewer problem
    • If all you want to do is display an element tree, wrapping it in a Page is overkill
    • You'd have to re-write all the support infrastructure for things like Suspending and Resuming, because they're frame-based, not page-based, and you'll break them

    If what you're trying to achieve is the ability for the user to display a new page by swiping, I think you'll be much better off just building the UI for that.


    Rebecca M. Riordan

    • Marked as answer by Aaron Xue Monday, May 06, 2013 10:00 AM
    Saturday, April 13, 2013 12:22 PM

All replies

  • To clarify what im after....

    I want to resemble the FlipView flip function from item to item.. But instead if items such as pictures i want to flip between pages.

    Friday, April 12, 2013 3:47 PM
  • I suspect the problem isn't with the pages--you say that's mostly working--but with the ScrollViewer. I eats some events. What handlers stop working?

    Rebecca M. Riordan

    Friday, April 12, 2013 6:02 PM
  • nah the problem really is that i want to flip between pages just as you do when you flip between pictures with the FlipViewer..

    And what i did was to use this code for the navigation between the pages:

    private void grid_ManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e)
            {
                initialPoint = e.Position;
            }

            private void grid_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
            {
                Point currentPoint = e.Position;
                if (currentPoint.X - initialPoint.X >= 100)
                {
                    this.Frame.Navigate(typeof(DIStatePage), ts);

                    e.Handled = true;
                }
                else if (currentPoint.X - initialPoint.X <= -100)
                {
                    this.Frame.Navigate(typeof(PassagePage), ts);

                    e.Handled = true;
                }

                if (currentPoint.Y - initialPoint.Y <= 200 && initialPoint.Y <= 60)
                {
                    TopAppBar.IsOpen = true;

                    e.Handled = true;
                }
            }


    And when it comes to the problem with the ScrollViewer the handlers for the ScrollViewer works but because the control is inside the Grid witch i have my navigation function on, i cant begin my swipe/flip inside the ScrollViewer.

    I can go around that if i set the ManipulationMode="All" for the ScrollViewer, but then the function for the scrollviewer stops working.

    So what i'm wondering is, can i somehow set the FlipView ItemsSource property to my Pages.

    Or in some other way have my Pages inside the FlipView, or maybe someone have a idea how one can resemble the Flip function.
    • Edited by Falkesand F Saturday, April 13, 2013 9:35 AM
    Saturday, April 13, 2013 9:32 AM
  • Well, ListView.Items.Item is defined as Object, so theoretically it's theoretically possible, but you're going to have to work really hard to convince me that it's a good idea.

    • You'd have to instantiate every Page in order to add them to the collection.
    • It's not going to solve (or even address) your ScrollViewer problem
    • If all you want to do is display an element tree, wrapping it in a Page is overkill
    • You'd have to re-write all the support infrastructure for things like Suspending and Resuming, because they're frame-based, not page-based, and you'll break them

    If what you're trying to achieve is the ability for the user to display a new page by swiping, I think you'll be much better off just building the UI for that.


    Rebecca M. Riordan

    • Marked as answer by Aaron Xue Monday, May 06, 2013 10:00 AM
    Saturday, April 13, 2013 12:22 PM