void OnItemSwiped(object sender, EventArgs args) { IsBusy = true; aiLayout.IsVisible = true; var layout = (BindableObject)sender; var note = (NoteGetModel)layout.BindingContext; Device.BeginInvokeOnMainThread(new Action(async() => { if (await DisplayAlert("Delete note", "Do you want to delete this note?", "Yes", "No")) { await viewModel.DeleteNote(note); } })); aiLayout.IsVisible = false; IsBusy = false; }