Windows phone 7 如何在windows phone 7中将消息框的“确定”和“取消”按钮转换为其他语言

Windows phone 7 如何在windows phone 7中将消息框的“确定”和“取消”按钮转换为其他语言,windows-phone-7,Windows Phone 7,这是一个问题,因为我想更改“确定”和“取消”按钮的一些文本 我想用其他语言来代替“ok”按钮,也可以用“cancel”按钮 大概是这样的: [OK] Đồng ý [Cancel] Hủy 我使用的是默认代码: if (MessageBox.Show("We are redirecting to our youtube channel?", "", MessageBoxButton.OKCancel) == MessageBoxResult.OK) {

这是一个问题,因为我想更改“确定”和“取消”按钮的一些文本

我想用其他语言来代替“ok”按钮,也可以用“cancel”按钮

大概是这样的:

[OK] Đồng ý
[Cancel] Hủy
我使用的是默认代码:

if (MessageBox.Show("We are redirecting to our youtube channel?", "", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {

                }

使用
MessageBox
类而不是实现自己的功能的动机是,控件的文本资源在运行时从系统中提取。这意味着,如果手机设置为另一种语言,则消息框控件将与该语言匹配

这意味着手机必须配置为越南语,而不是英语,这就少了很多工作:)

对于您创建的字符串(与本例中的
MessageBox
string相反),您可以使用所需的任何语言为字符串提供定义,然后更改手机的默认语言设置


您可以使用XNA DLL创建自定义消息框。允许的命名空间列表位于中。您需要在项目中添加
Microsoft.Xna.Framework.GameServices
程序集。您将注意到,该程序集的
Guide
类调用了方法。您可以使用它自定义消息框。下面是完整的代码

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
    }
}
资料来源:

此外,您还可以创建一个用户控件,其作用类似于自定义消息框check out

控件还具有CustomMessageBox


那么您不应该使用
windows-phone-8
标签。