开发者

MessageBox.Show for Windows Phone 7

I need a MessageBox.Show(), but with an extended functionality: the built-in messagebox for Windows Phone 7 won't show arbitrary buttons, just OK or cancel, I need for example YesNo as well. I need a Show method that will return only when the user clicks on a button. I tried to make my own messagebox as popup. The problem is that it is asynchronous as everything in the UI-thread in WP7, and I cannot block the U开发者_JAVA百科I-thread because the UI-thread is responsible for handling the button click events as well. I saw a ChildWindow example for WP7, but that was also asynchronous, I must have a Show() method that returns only when the user clicks. Any suggestions? Some kind of DoEvents() could help me a lot, but there is no such method in WP7 :(


You can use XNA's Guide.BeginShowMessageBox() to display a MessageBox with custom buttons. Here's a tutorial on how to use it.

Note that the MessageBoxIcon parameter does not select an icon on WP7, instead it selects the notification sound when the message box is displayed.

EDIT: Oops, didn't read your synchronous requirement before I posted. Maybe you can set a flag to stop whatever you want to prevent from running, and reset it once the user has made a selection.


I found this when looking for something similar, but wound up just using the built in messagebox. It would certainly give you the ability to have custom buttons.

Windows Phone 7 Custom Message Box


Use a Canvas that has everything you want on it. Then just use the visibility property to pop it up..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜