SevenWow
SevenWow

Reputation: 315

How to create a fullscreen size popup in Windows phone

Fullscreen I mean the popup usercontrol covers the whole cellphone screen, maximize. can this be done?

thx!

Upvotes: 0

Views: 2774

Answers (2)

Otto Kanellis
Otto Kanellis

Reputation: 3708

For Windows Phone 8.1 you can get the current Application width and height by Window.Current.Bounds

double height = Window.Current.Bounds.Height;
double width = Window.Current.Bounds.Width;

Upvotes: 1

You can get the current width and height by Content.ActualHeight/Width property here's a code snippet

    public void showPopUp()
    {
        //get heigth and width
        double height=Application.Current.Host.Content.ActualHeight;
        double width = Application.Current.Host.Content.ActualWidth;


      //child content
       StackPanel stk = new StackPanel();
       stk.Height = height; //set height
       stk.Width = width; //set width
       stk.Background = new SolidColorBrush(Colors.Red);
       TextBlock txtblock = new TextBlock() { FontSize=40, Text="HELLO WORLD", TextWrapping=TextWrapping.Wrap};
       stk.Children.Add(txtblock);


        Popup _popup = new Popup();

        _popup.Child = stk; //set child content

        this.LayoutRoot.Children.Add(_popup);
        _popup.IsOpen = true;

    }

and then you get this result ;) enter image description here

Upvotes: 5

Related Questions