Friday, 27 February 2015

MessageBox Popup in Windows Phone 8.1

Hello Every One,

How to Popup MessageBox in Windows phone 8.1 application?

MessageBox is used when your tast or activity will done then show a popup screen in windows phone 8.1 application.

Let's see how MessageBox will Popup. Follow below Steps.

Step 1:

Open Visual Studio 2013 create new Project in windows phone app. Select Blank App(Windows Phone) and give application name and location.

Step 2:

Open MainPage.xaml file and select one Button from toolbox panel, set Button content with "Popup MessageBox" like this :



Step 3:

Now goto MainPage.xaml.cs file and add new namespace.

using Windows.UI.Popups;

Step 4:

Now in button click event write below code :
Make your click event as async.

 private async void Button_Click(object sender, RoutedEventArgs e)
        {
            // MessageDialog msg = new MessageDialog("Hello World.");
            MessageDialog msg = new MessageDialog("Hello World.","MessageBox");
            await msg.ShowAsync();
        }



The MessageDialog class will create Messagebox  to popup and it take one or two argument.
"Hello World." is Message content or Message Body part.
"MessageBox" is Title of MessageBox.

Now You can Run the project and click on button to Popup the MessageBox.



Thank You for see this post.

No comments:

Post a Comment