Cancel Swipe

3 posts, 0 answers
  1. Ivo
    Ivo avatar
    4 posts
    Member since:
    May 2016

    Posted 23 Mar Link to this post

    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

  2. Rosy Topchiyska
    Admin
    Rosy Topchiyska avatar
    586 posts

    Posted 27 Mar Link to this post

    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
  3. Ivo
    Ivo avatar
    4 posts
    Member since:
    May 2016

    Posted 27 Mar Link to this post

    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();                }            }        }

  4. Ivo
    Ivo avatar
    4 posts
    Member since:
    May 2016

    Posted 27 Mar in reply to Ivo Link to this post

    Sorry for the bad formatting, as I accidentially hit the post-button while writing my answer -.-
Back to Top