Reputation: 418
In my Windows phone application, when the message box is displayed and if the phone is rotated, only the message box is getting rotated, whereas the UI behind it remains in the previous orientation.
It seems like the "Orientation changed" event of the page is not getting triggered when the message box is being displayed.
Although the UI behind the message box is not so prominent, I could find that the native messaging app of windows phone follows this behavior. I mean if the message box is displayed and the orientation is changed, the list behind the message box is also changed.
This image is of the native messaging app.
This image is from my application
You can notice the list behind the both the images.
Can I get some help in achieving this behavior ?
Upvotes: 1
Views: 133
Reputation: 12993
MessageBox.Show(string msg)
is a synchronized method, meaning the method won't return until you dismiss the message box by pushing one of its buttons. So UI thread is blocked, and the OrientationChanged
is only handled after the message box is dismissed since the event handler is running on UI thread, too.
MessageDialog.ShowAsync
, which is only available on Windows Phone 8.1, should not have this limitation.
One alternative to MessageBox
is the Popup
control. You can lay it on top of your page, and set it IsOpen
to true/false to show/hide it. Make it look good on both Landscape and Portrait orientations using ViewStates, just like other normal controls.
Upvotes: 1