OK Messagebox

using Windows.UI.Popups;

	//----- SHOW MESSAGEBOX -----
	var dialog = new MessageDialog("Main message...", "MessageBox title");
	dialog.Options = MessageDialogOptions.None;
	dialog.Commands.Add(new UICommand("OK", cmd => {}));
	dialog.DefaultCommandIndex = 0;
	dialog.CancelCommandIndex = 0;
	var command = await dialog.ShowAsync();

OK Cancel Messagebox

	var dialog = new MessageDialog("Main message...", "MessageBox title");
	dialog.Options = MessageDialogOptions.None;
	dialog.Commands.Add(new UICommand { Label = "OK", Id = 0 } );
	dialog.Commands.Add(new UICommand { Label = "Cancel", Id = 1 } );
	var command = await dialog.ShowAsync();
	if ((int)command.Id == 0)
	{
		//OK PRESSED
	}
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *