我想在屏幕中间居中弹出用户控件,我该怎么做?
Popup p = new Popup();
p.Child = new loadingtest();
p.isOpen = true;
最佳答案
var p = new Popup();
var content = new TextBox { Text = "hello world!" };
p.Child = content;
p.VerticalOffset = (this.ActualHeight - content.ActualHeight) / 2;
p.HorizontalOffset = (this.ActualWidth - content.ActualWidth) / 2;
p.IsOpen = true;
this
是 PhoneApplicationPage,popup 是 LayoutRoot
Grid 的子项。
关于c# - 如何在 Windows Phone 中居中弹出用户控件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19158957/