Display alert (displayalert()) on button click in custom listview

I have created the custom list view cell with 2 stack layout and button. used the same in the list view to display data.

When I click the button I want to display alert with button clicked row details.


  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭


    Or something like this...

  • Vaka.GopiNadhReddyVaka.GopiNadhReddy USMember ✭✭✭

    Hi @SivaShankarArumugam

    viewcell on button clicked event do like this

    Application.Current.MainPage.DisplayAlert("Alert", "Do you want to delete this item.", "Cancle", "Ok");

  • seanydaseanyda GBMember ✭✭✭✭✭

    This can be achieved by adding the DataTemplate to the actual page instead of in a separate class.

    public DataTemplate GetGroupCellTemplate ()
                return new DataTemplate (() => {
                    TextCell tc = new TextCell ();
                    tc.Tapped += (sender, e) =>
                        DisplayAlert("Test", "Test", "Test"); 
                    tc.SetBinding (TextCell.TextProperty, new Binding ("GroupName"));
                    return tc;
Sign In or Register to comment.