Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WP7: Rotating a popup + content?

I've been googling this issue for some time now, but havent been able to find a solution that worked for me. The thing is I have a popup control with a user control, in which the user can enter a new value for a listpicker. This all works fine in portrait mode, but if the phone is rotated (emulator), the popup remains in portrait mode. Opening the popup when phone is already in landscape, has no effect either.

Is there any way to correct this issue? I've seen some people suggesting using Rotatetransform, but if I do this on a textbox etc., it disappears completely :/

like image 422
David K Avatar asked Mar 10 '11 09:03

David K


2 Answers

I think this is potentially a bug in the Popup control; I've certainly heard the question asked before. However, I've also heard that the performance of the Popup controls is not that great, so I think you'd be better off just using a regular framework element (such as a Grid) to contain your popup content and show/hide it (with animation if appropriate) accordingly. At least that way it will get rotated properly when the page orientation changes.

like image 125
Derek Lakin Avatar answered Oct 23 '22 17:10

Derek Lakin


Do not rorate the popup but place a border inside the popup and load the content in the border.

I got it to work like this:

//In .xaml
<Popup x:Name="myPopup">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="480" />
        </Grid.RowDefinitions>

        <Border x:Name="popupBorder"/>
    </Grid>
</Popup>

//In .xaml.cs
popupBorder.Child = new MyPopupPage(); //MyPopupPage is the "Windows Phone Landscape Page"
myPopup.IsOpen = true;
like image 2
Tuomas Hautakangas Avatar answered Oct 23 '22 15:10

Tuomas Hautakangas