I got it using Wptoolkit:
first Install the Wptoolkit package
Install-Package WPToolkit
2nd Reference Toolkit in the shampoo:
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
Before:
mc:Ignorable="d"
3º Create a method inside the object that will receive the Swipe action, in my case is when the user slides over the ContentPanel
:
<!-- Logo, Dentro da Grid ContentPanel -->
<toolkit:GestureService.GestureListener >
<toolkit:GestureListener DragDelta="GestureListener_DragDelta"/>
</toolkit:GestureService.GestureListener>
fourth 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 him a 30 px slack to execute the code, thus preventing the user from accidentally activating the panel... You can do Vertical too, just change the Orientation
within the if
and else if
for Vertical
.