In my Windows 8.1 app I used MessageBox.Show() to popup a message. That is gone in UWP. How can I show a message?
To show a Popup, set its IsOpen property to true. To hide the Popup, set IsOpen to false. You can set IsLightDismissEnabled to make the Popup hide automatically when a user taps anywhere away from it.
Windows 10 introduced the Universal Windows Platform (UWP), which provides a common app platform on every device that runs Windows. The UWP core APIs are the same on all Windows devices.
NET Core. UWP is also known as Windows 10 UWP application. This application does not run on previous versions of Windows but will only run on future version of Windows. Following are a few exceptions where UWP will run smoothly.
Yup, indeed something like that, the new method is to use the MessageDialog class. You have to create an object of that type. You can also add buttons. It's a bit more complex I think. But you can also use some shortcuts here. To just show a message, use this:
await new MessageDialog("Your message here", "Title of the message dialog").ShowAsync();
To show an simple Yes/No message, you can do it like this:
MessageDialog dialog = new MessageDialog("Yes or no?");
dialog.Commands.Add(new UICommand("Yes", null));
dialog.Commands.Add(new UICommand("No", null));
dialog.DefaultCommandIndex = 0;
dialog.CancelCommandIndex = 1;
var cmd = await dialog.ShowAsync();
if (cmd.Label == "Yes")
{
// do something
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With