简体   繁体   中英

Message Box yesnoButtons in windows phone 7.5

In window phone 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.

Thanks in advance.

You can use the Coding4Fun MessagePrompt to create Yes/No message with custom buttons in this way:

        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. There is a BeginShowMessageBox method giving you the option to pass in whatever strings you wish for the buttons.

另一个选择是使用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. The YesNo and YesNoCancel enumeration values are not supported.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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