UWP显示全屏弹出式对话框,内容对话框或弹出式菜单
问题描述:
我需要在UWP应用程序中显示全屏对话框(在应用程序窗口边界中),但似乎无法使其工作。我试着用:UWP显示全屏弹出式对话框,内容对话框或弹出式菜单
ContentDialog只有FullSizeDesired =“真”
弹出窗口显示垂直拉伸,甚至试图设置在其背后的不工作
弹出按钮放置代码的宽度和高度=“Full”只能像contentdialog那样垂直拉伸它
不敢相信我花那么多时间在那个东西上:(
感谢
答
你有没有尝试过这样的事情:
var c = Window.Current.Bounds;
var g = new Grid
{
Width = c.Width,
Height = c.Height,
Background = new SolidColorBrush(Color.FromArgb(0x20, 0, 0, 0)),
Children =
{
new Rectangle
{
Width = 100,
Height = 100,
Fill = new SolidColorBrush(Colors.White),
Stroke = new SolidColorBrush(Colors.Black),
StrokeThickness = 3
}
}
};
var p = new Popup
{
HorizontalOffset = 0,
VerticalOffset = 0,
Width = c.Width,
Height = c.Height,
Child = g
};
p.IsOpen = true; // open when ready
你应该可以看到一个半透明的叠加,在你的屏幕中间的白色矩形。