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
close icon

SwipeOffset value at EndedEvent

Hi, the SwipeOffset value at SwipeEndedEventArgs is different from SwipeOffSet of SwipingEventArgs when I stop to swipe, is an issue or is right and I have misunderstood documentation?

As example if I set SfListView.SwipeOffset = 432
during swipe in log I have following values:
111.599983215332 during Swiping
113.599987030029 during Swiping
114.799991607666 during Swiping
115.599990844727 during Swiping
432 at Swipe Ended (stop swipe near at half screen)

If I stop swipe around the half of the screen, I'm expecting a value near 216 and stop or reset swipe template render to 0 since my code call ResetSwipe() if value > 300, instead I get max offset value (432) and the template fill all swiped item row, as attached image

Attachment: templateFillRow_654844c0.7z

1 Reply

DB Dinesh Babu Yadav Syncfusion Team June 5, 2017 09:00 AM UTC

Hi Emanuele, 
 
Thank you for using Syncfusion Products. 
 
We would like to let you know that based on the SwipeThreshold property, the SwipeOffset value is returned in the SwipeEndedEventArgs of SwipeEnded event. The SwipeThreshold (Restricts the layout of swipe view up to a certain position while swiping the item) property indicates that if you have swiped lesser than SwipeThreshold value, then the swiped item is reset automatically and returns “0” in the SwipeOffset value in SwipeEndedEventArgs else if you have swiped greater than SwipeThreshold value, then the swiped item is layout based on the SfListView’s SwipeOffset property and returns the same in the event arguments. This is the actual behavior of SfListView. 
 
So, we could suggest you to achieve your requirement by setting the SwipeThreshold value by which the swiped item is reset automatically if swiped lesser than this value. Also, you can handle the swiping in the Swiping event, If Handled is true, current swipe offset value remain same for the swiped item until the SwipeEnded event is raised as like below code snippet. 
 
Code Example[C#]: 
private void ListView_Swiping(object sender, SwipingEventArgs e) 
{ 
  if (e.SwipeOffSet > 300) 
     e.Handled = true; 
} 
 
For your reference, we have attached the sample and you can download it from the below link. 
 
 
Please let us know if you require further assistance. 
 
Regards, 
Dinesh Babu Yadav 
 


Loader.
Live Chat Icon For mobile
Up arrow icon