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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Using Last item in Listview to add new item to the list in runtime

Thread ID:

Created:

Updated:

Platform:

Replies:

141633 Dec 21,2018 10:40 PM UTC Dec 24,2018 08:50 AM UTC Xamarin.Forms 1
loading
Tags: SfListView
subha
Asked On December 21, 2018 10:40 PM UTC

I am using SfListview in my Xamarin.Forms app. I am using left swipe, right swipe and drag and drop features in the listview. I wish to remove swipe and drag and drop for last item alone. I am using last item as Add Item row, so that user can add new item to the list dynamically at runtime.  But I wish to remove swipe and reordering feature which doesn't make sense for last item. 


Is that possible???

Vigneshkumar Ramasamy [Syncfusion]
Replied On December 24, 2018 08:50 AM UTC

Hi Subha,  
   
Thanks for using Syncfusion product.  
  
We have checked reported query from our side. We would like to know you can skip swiping in SwipeStarted event and dragging in ItemDragging event by using specific index for which action is needed to be skipped or use can even load your add icon in FooterTemplate which will not swipe or drag when dragging or swiping option enabled for listview. We have already mentioned about this in our UG documentation, please refer UG from below link.  
  
  
  
  
  
  
namespace ListViewSample  
{  
    public partial class MainPage : ContentPage  
    {  
        public MainPage()  
        {  
            listView.SwipeStarted += ListView_SwipeStarted;  
            listView.ItemDragging += ListView_ItemDragging;  
        }  
  
        private void ListView_ItemDragging(object sender, Syncfusion.ListView.XForms.ItemDraggingEventArgs e)  
        {  
            int lastItemIndex = listView.DataSource.DisplayItems.Count-1;  
            if (e.Action == DragAction.Start && e.NewIndex == lastItemIndex)  
                e.Cancel = true;  
        }  
  
        private void ListView_SwipeStarted(object sender, Syncfusion.ListView.XForms.SwipeStartedEventArgs e)  
        {  
            int lastItemIndex = listView.DataSource.DisplayItems.Count-1;  
  
            if (e.ItemIndex == lastItemIndex)  
                e.Cancel = true;  
        }  
    }  
}  
  
  
   
  
Regards,  
Vigneshkumar R 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

;