I work in windows phone 8 and I have two pivot item in a Pivot control. How to detect if i swiped to the right or to the left ?
Step1:Add Microsoft.Phone.Controls.Toolkit in your solution
Step2:Add Microsoft.Phone.Controls.Toolkit reference in xaml like this:
xmlns:tolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
Step3:Create gesture listener flick event like this:
<Grid x:Name="LayoutRoot" Background="Transparent">
<tolkit:GestureService.GestureListener>
<tolkit:GestureListener Flick="GestureListener_Flick"></tolkit:GestureListener>
</tolkit:GestureService.GestureListener>
<!--Pivot Control-->
<controls:Pivot Title="MY APPLICATION">
<!--Pivot item one-->
<controls:PivotItem Header="item1">
<Grid/>
</controls:PivotItem>
<!--Pivot item two-->
<controls:PivotItem Header="item2">
<Grid/>
</controls:PivotItem>
</controls:Pivot>
</Grid>
Step 4:In your cs page add this code:
private void GestureListener_Flick(object sender, FlickGestureEventArgs e)
{
if (e.Direction.ToString() == "Horizontal") //Left or right
{
if (e.HorizontalVelocity > 0) //Right
{
}
else //Left
{
}
}
}