【问题标题】:Change message box buttons' name in windows phone在 windows phone 中更改消息框按钮的名称
【发布时间】:2013-09-21 21:05:18
【问题描述】:

我想更改出现在我的应用程序中的消息框按钮中的文本。 例如,我想使用“相机”而不是“是”,而不是“否”,我想使用“媒体库”。有人知道吗??

这是我走了多远..

DialogResult dlgResult=MessageBox.Show("导入照片","选择从哪里导入照片",MessageBoxButtons.YesNo,MessageBoxIcon.None);

我非常挣扎,欢迎任何想法。 谢谢

【问题讨论】:

    标签: windows-phone-7 messagebox


    【解决方案1】:

    您不能更改 MessageBox 的默认按钮。更好的是,您可以Microsoft Phone Toolkit 在此您可以使用所需的左右按钮创建自定义消息框,还可以设置单击这些按钮时的功能。

    要下载 NuGet,请点按此处。并在您的项目中按左键单击,然后管理 NuGet 包并搜索 Microsoft Phone Toolkit,找到该包后,只需按安装,然后使用我的以下代码。

    CustomMessageBox messageBox = new CustomMessageBox()
            {
                Title = "Inport photo", //your title
                Message = "Select from where to import photo", //your message
                RightButtonContent = "Yes", // you can change this right and left button content
                LeftButtonContent = "No",
            };
    
            messageBox.Dismissed += (s2, e2) =>
            {
                switch (e2.Result)
                {
                    case CustomMessageBoxResult.RightButton:
                        //here your function for right button
                    break;
                    case CustomMessageBoxResult.LeftButton:
                        //here your function for left button
                    break;
                    default:
                    break;
                }
            };
    
            messageBox.Show();
    

    【讨论】:

      【解决方案2】:

      默认 Silverlight API 不允许您这样做,但 XNA API 可以。见以下链接:

      http://dotnet.dzone.com/articles/delivering-message-using

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多