irperez
irperez

Reputation: 1777

How do you utilize the flipview and make a "selection" by tapping or clicking the screen?

In Win 8, the flipview control is a great control to browse the collection. But how or what is the best way to make a "selection" with a tap or a mouse click? I can always put a button outside of the flip view, but that's not the touch experience that everyone of a tablet would expect.

can someone give some example code (XAML/C#) of how to setup a flipview control with a selection of some sort that would navigate to a totally different page?

Upvotes: 3

Views: 1852

Answers (1)

Jennifer Marsman - MSFT
Jennifer Marsman - MSFT

Reputation: 5225

I wrote some sample code that works, if I'm understanding the question correctly. I am able to swipe through the FlipView and tap the individual item:

<FlipView Tapped="FlipView_Tapped_1">
    <Image Source="Images/Apple.jpg" />
    <Image Source="Images/Orange.jpg" />
    <Image Source="Images/Banana.jpg" />
</FlipView>

And then

private YourTypeHere SelectedItem;
private void FlipView_Tapped_1(object sender, TappedRoutedEventArgs e)
{
    this.SelectedItem = (sender as FlipView).SelectedItem;
}

You might not want to set a field, but you get the idea. Hopefully, you will be setting something in your view model. From there you can nav away or anything you need. A FlipView inherits from ItemsControl just like every other XAML repeater. So you can treat it exactly the same. http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.aspx

Upvotes: 5

Related Questions