How to display a message in Windows Store Apps?

user1547566 picture user1547566 · Sep 15, 2012 · Viewed 46k times · Source

How to display a message box in windows 8 apps using c# like calling MessageBox.Show() in windows phone 7?

Answer

Inder Kumar Rathore picture Inder Kumar Rathore · Mar 13, 2013
   MessageDialog msgDialog = new MessageDialog("Your message", "Your title");

   //OK Button
   UICommand okBtn = new UICommand("OK");
   okBtn.Invoked = OkBtnClick;
   msgDialog.Commands.Add(okBtn);

   //Cancel Button
   UICommand cancelBtn = new UICommand("Cancel");
   cancelBtn.Invoked = CancelBtnClick;
   msgDialog.Commands.Add(cancelBtn);

   //Show message
   msgDialog.ShowAsync();

And your call backs

private void CancelBtnClick(IUICommand command)
{
}

private void OkBtnClick(IUICommand command)
{
}


P.S. You can follow this tutorial for more.