How to create a fullscreen size popup in Windows phone

有些话、适合烂在心里 提交于 2019-12-11 23:42:14

问题


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

thx!


回答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 ;)




回答2:


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;


来源:https://stackoverflow.com/questions/19173205/how-to-create-a-fullscreen-size-popup-in-windows-phone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!