简体   繁体   English

Windows Phone 7.5中的消息框yesnoButtons

[英]Message Box yesnoButtons in windows phone 7.5

In window phone 7.5 . 在窗口电话7.5。 I want to use yes no buttons in message box . 我想在消息框中使用“是”没有按钮。 But there is no option for yes no buttons in message box. 但是在消息框中没有选项是。 How can i use with yes no buttons or other alternate to show caption (OK =yes and cancel =no) Please help me. 我该如何使用yes否按钮或其他替代按钮来显示字幕(OK =是,然后取消= no)请帮助我。

Thanks in advance. 提前致谢。

You can use the Coding4Fun MessagePrompt to create Yes/No message with custom buttons in this way: 您可以通过以下方式使用Coding4Fun MessagePrompt使用自定义按钮创建“是/否”消息:

        MessagePrompt messagePrompt = new MessagePrompt();
        messagePrompt.Message = "Some Message.";
        Button yesButton = new Button() { Content = "Yes" };
        yesButton .Click += new RoutedEventHandler(yesButton _Click);
        Button noButton = new Button() { Content = "No" };
        noButton .Click += new RoutedEventHandler(noButton _Click);
        messagePrompt.ActionPopUpButtons.Add(noButton);
        messagePrompt.ActionPopUpButtons.Add(yesButton );
        messagePrompt.Show();

Another option is to use the Guide class from the XNA framework. 另一个选择是使用XNA框架中的Guide类。 There is a BeginShowMessageBox method giving you the option to pass in whatever strings you wish for the buttons. 有一个BeginShowMessageBox方法,使您可以选择传递按钮所需的任何字符串。

另一个选择是使用Coding4fun工具包中的MessagePrompt并根据需要进行自定义

Yes, the problem with WP MessageBox is that it only supports the OK and OKCancel MessageBoxButton, which means that you're limited to either an ok button or an ok and a cancel button. 是的,WP MessageBox的问题在于它仅支持OK和OKCancel MessageBoxButton,这意味着您只能使用“确定”按钮或“确定”和“取消”按钮。 The YesNo and YesNoCancel enumeration values are not supported. 不支持YesNo和YesNoCancel枚举值。

Basically you can try to display a semi-transparent blanking layer over the page content, and then display a custom message box on top of that. 基本上,您可以尝试在页面内容上显示一个半透明的空白层,然后在其上方显示一个自定义消息框。 Here , you can find a complete sample. 在这里 ,您可以找到完整的示例。

Another option is to use a custom library like Windows Phone Assets . 另一个选择是使用自定义库,例如Windows Phone Assets

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM