我想使用 MessageBox 来显示我的 WP8.1 应用程序中的下载错误。
我补充说:
using System.Windows;
但是当我输入时:
MessageBox.Show("");
我得到错误:
"The name 'MessageBox' does not exist in the current context"
在对象浏览器中,我发现这样的类应该存在,并且在“项目->添加引用...->程序集->框架”中显示所有程序集都被引用。
我错过了什么吗?还是有另一种方式来显示消息框之类的东西?
最佳答案
对于通用应用程序,新 API 要求您使用 await MessageDialog().ShowAsync()
(在 Windows.UI.Popups 中)使其与 Win 8.1 保持一致。
var dialog = new MessageDialog("Your message here");
await dialog.ShowAsync();
关于c# - 通用应用消息框 : "The name ' MessageBox' does not exist in the current context",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22909329/