Universal Apps MessageBox: "The name 'MessageBox' does not exist in the current context"

uwp messagedialog
winrt messagebox
uwp popup
vb net uwp messagebox
flyout app
windows 10 message box
uwp app alert
wpf messagedialog

I want to use MessageBox for showing download errors in my WP8.1 app.

I added:

using System.Windows;

but when I type:

MessageBox.Show("");

I get error:

"The name 'MessageBox' does not exist in the current context"

In Object Browser I found that such class should exist and in "Project->Add reference... ->Assemblies->Framework" is shown that all assemblies are referenced.

Do I miss something? Or is there another way how to show something like messagebox?


For Universal Apps, the new APIs require you to use await MessageDialog().ShowAsync() (in Windows.UI.Popups) to bring it into line with Win 8.1.

var dialog = new MessageDialog("Your message here");
await dialog.ShowAsync();

MessageDialog Class (Windows.UI.Popups), are upgrading a Universal Windows 8 app that uses MessageDialog, and need to For new apps in Windows 10, we recommend using the ContentDialog  If you are looking out for a sample code snippet to demonstrate how to display Message Box in Windows Sore Universal App , below is a sample code snippet that demonstrates how to do it. How to display Message Box in Windows Store Universal App ? MessageDialog dialog = new MessageDialog("Do you want to View …


Just wanted to add to ZombieSheep's answer: also, customization is quite simple

        var dialog = new MessageDialog("Are you sure?");
        dialog.Title = "Really?";
        dialog.Commands.Add(new UICommand { Label = "Ok", Id = 0 });
        dialog.Commands.Add(new UICommand { Label = "Cancel", Id = 1 });
        var res = await dialog.ShowAsync();

        if ((int)res.Id == 0)
        { *** }

Dialogs and flyouts, Dialogs. Example of a dialog. Dialogs are modal UI overlays that provide contextual app information. Dialogs block interactions with the 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


try this:

 using Windows.UI.Popups;

code:

private async void Button_Click(object sender, RoutedEventArgs e)
    {

        MessageDialog msgbox = new MessageDialog("Would you like to greet the world with a \"Hello, world\"?", "My App");

        msgbox.Commands.Clear();
        msgbox.Commands.Add(new UICommand { Label = "Yes", Id = 0 });
        msgbox.Commands.Add(new UICommand { Label = "No", Id = 1});
        msgbox.Commands.Add(new UICommand { Label = "Cancel", Id = 2 });

        var res = await msgbox.ShowAsync(); 

        if ((int)res.Id == 0)
        {
            MessageDialog msgbox2 = new MessageDialog("Hello to you too! :)", "User Response");
            await msgbox2.ShowAsync();
        }

        if ((int)res.Id == 1)
        {
            MessageDialog msgbox2 = new MessageDialog("Oh well, too bad! :(", "User Response");
            await msgbox2.ShowAsync();
        }

        if ((int)res.Id == 2)
        {
            MessageDialog msgbox2 = new MessageDialog("Nevermind then... :|", "User Response");
            await msgbox2.ShowAsync();
        }


    }

To Trigger some Function When "Yes" or "No" is clicked, You can also use:

msgbox.Commands.Add(new UICommand("Yes", new UICommandInvokedHandler(this.TriggerThisFunctionForYes)));
msgbox.Commands.Add(new UICommand("No", new UICommandInvokedHandler(this.TriggerThisFunctionForNo)));

Message Box in Windows Store App, Message Dialogs in Window Store apps are the equivalent of Message Boxes in classic Windows. In this article, we will learn how to display a  Message Dialogs in Window Store apps are the equivalent of Message Boxes in classic Windows. In this article, we will learn how to display a message box in a Windows Store app using the MessageDialog class. The MessageDialog class is used to create and display a message dialog. This class is defined in the namespace "Windows.UI.Popups".


You could also make a class like the next one. Below the code a usage example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Popups;

namespace someApp.ViewModels
{
    public static class Msgbox
    {
        static public async void Show(string mytext)
        {
            var dialog = new MessageDialog(mytext, "Testmessage");
            await dialog.ShowAsync();
        }
    }

}

The example to use it in a class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace someApp.ViewModels
{
    public class MyClass{

        public void SomeMethod(){
            Msgbox.Show("Test");
        }

    } 
}

Displaying a Yes, No, Cancel Message Dialog in a Universal , In a Universal App, the MessageDialog class is used to display an alert dialog with a set of choices for the user to make. According to the  Good day everyone. I am sure the friendly guys at Microsoft are working extremely hard on bringing us a native Messagebox in PowerApps. In the meantime, please see below article to create your own using a centralized messagebox, without having to place warning and confirmation prompts all over you


public sealed partial class MainPage : Page {
    public MainPage() {
        this.InitializeComponent();
    }

    public static class Msgbox {
        static public async void Show(string m) {
            var dialog = new MessageDialog( m);            
            await dialog.ShowAsync();
        }
    }

    private void Button_Click(object sender, RoutedEventArgs e) { 
        Msgbox.Show("This is a test to see if the message box work");
        //Content.ToString();
    }
}

Message Dialog in UWP Tutorial Part-6, C# WPF UI Tutorials: 21 - Custom Dialog System Message Box Popup - Duration: 1:39:11 Duration: 4:14 Posted: Sep 16, 2017 MessageBox MessageBox MessageBox MessageBox Class. Definition. Displays a message window, also known as a dialog box, which presents a message to the user. It is a modal window, blocking other actions in the application until the user closes it.


Windows 10 Universal Apps - Custom Dialog, Website : http://www.edmtdev.com Create Custom Message Box for your own UWP app Duration: 4:38 Posted: May 25, 2016 MessageDialog(String, String) MessageDialog(String, String) MessageDialog(String, String) MessageDialog(String, String) MessageDialog(String, String) Initializes a new instance of the MessageDialog class to display a titled message dialog that can be used to ask your user simple questions.


Universal Apps MessageBox: "The name 'MessageBox , Universal Apps MessageBox: "The name 'MessageBox' does not exist in the current context". Question. I want to use MessageBox for showing download errors  In a Universal App, the MessageDialog class is used to display an alert dialog with a set of choices for the user to make. According to the documentation, this class supports up to three commands. According to the documentation, this class supports up to three commands.


Thread: Creating a MessageBox in a Windows 8 Store app, 110745 Then you can easily create a message box using code from on Windows 10 using Visual Studio 2015, as a Universal Windows app  This post was written by Lucian Wischik, a Program Manager on the Managed Languages team. We just released the Universal Windows app development tools for writing Windows 10 apps in Visual Studio 2015. It is an exciting release: you can now use the latest .NET technology to build Universal Windows Platform (“UWP”) apps that run on every Windows device –