- Home
- Forum
- Xamarin.Android
- How to run a sliding function to the right and to the left?
How to run a sliding function to the right and to the left?
Today I downloaded the syncfusion tools, and managed to use a data grid with the sliding property, now I want to know how to execute a function when I slide right or left, could someone give me an example?
SIGN IN To post a reply.
3 Replies
DS
Divakar Subramaniam
Syncfusion Team
September 29, 2017 07:02 AM UTC
Hi Oscar,
Thanks for contacting Syncfusion support.
In SfDataGrid, three events will be raised while swiping. If you start the swiping process, then SwipeStarted event will be raised. If the swiping is in progress, then Swiping event will be raised. If the swiping operation is ended, then SwipeEnded event will be raised. Please refer the below code snippet,
|
dataGrid.SwipeStarted += DataGrid_SwipeStarted;
dataGrid.Swiping += DataGrid_Swiping;
dataGrid.SwipeEnded += DataGrid_SwipeEnded;
//Swipe ended event will fire once you the swiping process is ended
private void DataGrid_SwipeEnded(object sender, SwipeEndedEventArgs e)
{
}
//Swiping event will fire when the swiping process is in progress
private void DataGrid_Swiping(object sender, SwipingEventArgs e)
{
}
//Swipe started event will fire once you started the swiping process
private void DataGrid_SwipeStarted(object sender, SwipeStartedEventArgs e)
{
} |
Please refer the below UG link to know more about SfDataGrid swiping feature and its events,
Also, we have prepared a sample using swiping feature and you can download the same from the below link,
Regards,
Divakar.
ON
oscar navarro
September 29, 2017 03:14 PM UTC
Thanks, but how could I execute a function when I slide to the left, and another function when I slide right, because I could already use the "DataGrid_SwipeEnded" event, but always executes the same function when I slide to both sides
VP
Vimal Prabhu Manohkaran
Syncfusion Team
October 1, 2017 06:14 PM UTC
Hi Oscar,
Thanks for the update. You can check the direction of the swipe using the SwipeDirection property of the SwipeEndedEventArgs provided in the SwipeEnded event handler. Please refer the below code snippet to achieve your requirement.
Thanks for the update. You can check the direction of the swipe using the SwipeDirection property of the SwipeEndedEventArgs provided in the SwipeEnded event handler. Please refer the below code snippet to achieve your requirement.
|
private void DataGrid_SwipeEnded(object sender, SwipeEndedEventArgs e)
{
if (e.SwipeDirection == SwipeDirection.Right)
PerformFunction1();
else
PerformFunction2();
} |
Please refer the sample below for reference where we have added a new row when swiped right and deleted the first row when swiped left.
Sample Link : http://www.syncfusion.com/downloads/support/forum/132930/ze/Sample1564403347
Sample Link : http://www.syncfusion.com/downloads/support/forum/132930/ze/Sample1564403347
Regards,
Vimal Prabhu
Vimal Prabhu
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
ON oscar navarro
- Sep 28, 2017 10:22 PM UTC
- Oct 1, 2017 06:14 PM UTC