get a full screen popup to work on WP8

link:http://stackoverflow.com/questions/14029639/windows-phone-8-popup-width-and-height

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; 
}

posted on 2013-03-26 15:43  wlqsmiling  阅读(413)  评论(0编辑  收藏  举报

导航