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. Image for the cookie policy date

How to close LeftSwipe on DataGrid selected row change

Hi,May I know the best way to close the LeftSwipeTemplate on DataGrid's programatically? Usecase: I select one row and swipe to edit it.Then I select another record (selected row changed by using TapGestureRecognizer). Now I don't want to leave the LeftSwipe view open. I want to close it. I couldn't find anyway to close it.I have just one column in my DataGrid and it is a GridTemplateColumn type. When you implement TapGestureRecognizer the default SwipeView close functionality not working anymore. So, I have to close the SwipeView programmatically.Thanks!                                                                                                                                                                                       

1 Reply

SS Sivaraman Sivagurunathan Syncfusion Team May 8, 2017 11:38 AM UTC

Hi Charith, 
   
Thanks for using Syncfusion products. 
   
We have checked your query. SfDataGrid will not handle touch operations, if its child view has already handled and taken over the touch. This is because the child view suppresses the parent's touch and since you are using TapGestureRecognizer inside template column, this suppresses the touch of SfDataGrid which is why the swipe view was not collapsed on tap. However, you can programmatically close the swipe view in SfDataGrid using SfDataGrid.ResetSwipeOffset() method. 
    
The below code example illustrates how to close the swipe view programmatically.    
   
private void Btn_Clicked(object sender, EventArgs e)   
{   
    dataGrid.ResetSwipeOffset();   
}   
  
Regards,

Sivaraman  
 


Loader.
Up arrow icon