I was able to use WPToolkit:
1st Install the WPToolkit package
Install-Package WPToolkit
2nd Referencing the toolkit in xaml:
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
Before:
mc:Ignorable="d"
3rd Create a method inside the object that will receive the swipe action, in my case it is when the user slides over ContentPanel
:
<!-- Logo, Dentro da Grid ContentPanel -->
<toolkit:GestureService.GestureListener >
<toolkit:GestureListener DragDelta="GestureListener_DragDelta"/>
</toolkit:GestureService.GestureListener>
4th Handle handling in .cs
private void GestureListener_DragDelta(object sender, DragDeltaGestureEventArgs e)
{
if(e.Direction == System.Windows.Controls.Orientation.Horizontal && e.HorizontalChange > 30)
{
painel.Visibility = System.Windows.Visibility.Visible;
}
else if(e.Direction == System.Windows.Controls.Orientation.Horizontal && e.HorizontalChange < -30)
{
painel.Visibility = System.Windows.Visibility.Collapsed;
}
}
In case I gave 30 px to run the code, thus preventing the user from accidentally activating the panel ... You can do in Vertical too, just change the Orientation
inside the if
and else if
to Vertical
.