Search code examples
windows-phone-8.1messagedialog

MessageDialog Box in windows phone 8.1?


I am using MessageDialog box for popup.but in this it shows only particular meaasge.I want to okcancel buttons with this popup.how to get these buttons.please any one help me.Thanks in advance.


Solution

  • To do that, you need to add the buttons yourself.

    var dialog = new MessageDialog("Error. Noooo...");
    dialog.Commands.Add(new UICommand("OK", OnOKButtonClicked));
    dialog.Commands.Add(new UICommand("Cancel"));
    
    dialog.ShowAsync();
    

    Where OnOKButtonClicked is a method:

    private void OnOKButtonClicked(IUICommand command)
    {
    
    }