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 UI-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 :(
3 Answers
6
votes
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.
2
votes