Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How can i create delete event for button in ListView ?

ShahabuddinVansiwalaShahabuddinVansiwala USMember ✭✭
edited November 2015 in Xamarin.Forms


How can i create delete event for button in ListView with Yes/No Popup Box ?
Because i have already created listView.ItemSelected event for edit.
In this Program When i click on list of Name then Navigate to Registration Page for update.
But i want to create Delete event for button with Yes/No Popup box on same page .

What can i do ??


  • JacobPoulsen_JacobPoulsen_ DKMember ✭✭✭

    I have previous used two ways for this, both with succes.

    One way is to use the MessagingCenter: and the subscribe from either the ContentPage or Listview, and use your custom Cell to send.

    The other way would be creating your custom cell with a Page in the constructor like this:

    public class CustomCell : ViewCell
        public CustomCell(MyContentPage myContentPage)
        // More stuff
        //When delete button is pressed, use this   

    Then i could use the cell like this on MyContentPage which is the page that contains the ListView:

    public class MyContentPage : ContentPage
        public MyContentPage()
            // Setup listview..
            myListview.ItemTemplate = new DataTemplate(new CustomCell(this));

    I bet there are other ways of doing this, but so far this has worked just fine :)

Sign In or Register to comment.