We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to run a sliding function to the right and to the left?

Thread ID:

Created:

Updated:

Platform:

Replies:

132930 Sep 28,2017 10:22 PM UTC Oct 1,2017 06:14 PM UTC Xamarin.Android 3
loading
Tags: SfDataGrid
oscar navarro
Asked On September 28, 2017 10:22 PM UTC


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?

Divakar Subramaniam [Syncfusion]
Replied On 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. 


oscar navarro
Replied On 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


Vimal Prabhu Manohkaran [Syncfusion]
Replied On 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.
 
 
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

 
Regards,
Vimal Prabhu
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;