如何在Windows Phone中创建全屏大小弹出窗口 [英] How to create a fullscreen size popup in Windows phone
本文介绍了如何在Windows Phone中创建全屏大小弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
全屏,我的意思是弹出用户控件覆盖整个手机屏幕,最大化.可以做到吗?
Fullscreen I mean the popup usercontrol covers the whole cellphone screen, maximize. can this be done?
thx!
推荐答案
您可以通过Content.ActualHeight/Width属性获取当前的宽度和高度. 这是一个代码段
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 ;)
这篇关于如何在Windows Phone中创建全屏大小弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文