您可以使用 XNA DLL 创建自定义消息框。允许的名称空间列表在XNA Framework 和 Windows Phone 8 开发中。您需要Microsoft.Xna.Framework.GameServices
在项目中添加程序集。您会注意到该Guide
程序集的类具有称为 的方法BeginShowMessageBox(...)
。您可以使用它来自定义消息框。以下是完整代码。
IAsyncResult result = Microsoft.Xna.Framework.GamerServices.Guide.BeginShowMessageBox(
"",
"We are redirecting to our youtube channel?",
new string[] { "Đồng ý", "Hủy" },
0,
Microsoft.Xna.Framework.GamerServices.MessageBoxIcon.None,
null,
null);
result.AsyncWaitHandle.WaitOne();
int? choice = Microsoft.Xna.Framework.GamerServices.Guide.EndShowMessageBox(result);
if(choice.HasValue)
{
if(choice.Value == 0)
{
//User clicks on the first button
}
}
来源:Windows Phone 的高级 MessageBox
此外,您还可以创建一个类似于自定义消息框的用户控件,请查看为 Windows Phone 应用程序创建自定义消息框
TCD.Controls 也有 CustomMessageBox。
用于 TCD.Controls 的 NuGet
使用 TCD.Controls 的 WPF 和 Windows Phone 的自定义(异步)消息框