I am placing a grid in a popup control. I expected the grid to be re-sized automatically according to the 3 different layout sizes for windows phone 8 apps (480 × 80
The easiest way to get a full screen popup to work on WP8 is by setting the Child width & height to the phone's current logical resolution. You can read more about WP8 Multi-resolution zen here and learn more about WP8 Multi-resolution APIs here.
private void Button_Click_1(object sender, RoutedEventArgs e)
{
var myPopup = new Popup()
{
Child = new Border()
{
Child = new TextBlock()
{
Text = "Hello World!"
},
Height = Application.Current.Host.Content.ActualHeight,
Width = Application.Current.Host.Content.ActualWidth,
Background = new SolidColorBrush(Colors.Green)
}
};
this.LayoutRoot.Children.Add(myPopup);
myPopup.IsOpen = true;
}
This code snippet is a bit overzealous since shell items (e.g. SystemTray, AplicaitonBar, etc) can take space away from your rendering area.
Here's a print screen of the code snippet above executing in the WXGA emulator:
And here's the code snippet above executing in the 720P emulator: