This is a migrated thread and some comments may be shown as answers.
Cancel Swipe
3 Answers 49 Views
This is a migrated thread and some comments may be shown as answers.
Ivo
Top achievements
Rank 1
Ivo asked on 23 Mar 2017, 10:13 AM

Hi,

in our Xamarin-Forms Project, I use a Telerik ListView (LinearLayout) with swiping. For some cells, i want to disable swiping. In your manual [1] i read, that by setting the Cancel-property of the ItemSwipeStartingEventArgs to false in the StartSwiping-Event:

public void OnItemSwipeStarting(object sender, ItemSwipeStartingEventArgs e)

{

    var swipedItem = e.Item as OurItem;

   if (swipedItem.HasACertainProperty == true)

   {

        // For some items, we want to "disable" the swiping

         e.Cancel = false;    

    }

}

This does not work, but when i set e.Cancel to true, then

in iOS - swiping is disabled as expected.

in Android - we get a NullPointerException: (Java.Lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Rect.height()' on a null object reference)

in UWP - the CellContent disapears and never comes back again :'-(

 

The question is: is it possible to "disable" swiping for some cells in the Telerik ListView? If the answer is yes, how could I do this?

 

Thank you very much in advance.

All the best,

Ivo

 

[1] http://docs.telerik.com/devtools/xamarin/controls/listview/gestures/listview-gestures-cell-swipe

3 Answers, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 27 Mar 2017, 02:42 PM
Hi Ivo,

Thank you for contacting us.

Indeed, there is an issue with canceling the item swipe. I have logged a bug report in our feedback portal where you can track the status of the issue. I have also updated your Telerik points as a token of gratitude for bringing this issue to our attention.

Regards,
Rosy Topchiyska
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ivo
Top achievements
Rank 1
answered on 27 Mar 2017, 03:29 PM

Hi Rosy,

 

thank you very much for your Reply - since you have a bugfix for this, I use the ItemSwiping-Event as a workaround for this bug:

public void OnItemSwiping (object sender, ItemSwipingEventArgs e)       

 {           

 //Workaround, that prevents swiping 

// as e.Cancel does not work properly in UWP and Droid            

if (Device.OS != TargetPlatform.iOS)           

 {                

    var swipedItem = e.Item as OurItem;                

if (swipedItem.IsYellowNoteCapable)                {                    listView.EndItemSwipe();                }            }        }

0
Ivo
Top achievements
Rank 1
answered on 27 Mar 2017, 03:30 PM
Sorry for the bad formatting, as I accidentially hit the post-button while writing my answer -.-
Asked by
Ivo
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Ivo
Top achievements
Rank 1
Share this question
or