The name ‘MessageBox’ does not exist in the current context for Universal App

In the earlier versions of Windows Phone , we could use the MessageBox.Show method to display message box within the Windows Phone app .

When tried to use the same within the Universal App , you might get an error.

The name ‘MessageBox’ does not exist in the current context

This is because , the Universal App / Windows Phone 8.1 XAML App has the new API defines in the Windows.UI.Popups name space which provides the MessageDialog class to display the messagebox with in the Universal App.

How to display MessageBox in Universal Apps ?

var dialog1 = new MessageDialog("Test Message from Ginktage");
await dialog1.ShowAsync();

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Reply