Confirmation Dialog on back button press event Xamarin.Forms

后端 未结 6 827
北海茫月
北海茫月 2020-12-14 19:16

I am stuck at one point in Xamarin.Forms application

On Back button press simply I want to ask user to confirm whether he really wants to exit or not, \"OnBackButton

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-14 19:38

     private async void OnDelete(object sender, EventArgs e)
            {
                var result = await this.DisplayAlert("Alert!", "Do you really want to exit?", "Yes", "No");
                if (result)
                {
    
                    var menuitem = sender as MenuItem;
                    string name = menuitem.BindingContext as string;
    
                    lielements.Remove(name);
                }
                else
                {
    
    
                }
    
            }
    

提交回复
热议问题