【发布时间】:2023-04-05 03:37:01
【问题描述】:
我想将 PopUp 准确地置于屏幕中心。 我使用了一个用户控件在弹出窗口中显示。 但是我计算水平偏移和垂直偏移的方式是错误的。
Popup popUp = new Popup();
ProgressScreen progressScreen = new ProgressScreen();
popUp.Child = progressScreen;
//popUp.HorizontalOffset = (this.ActualWidth/2) + (progressScreen.ActualWidth / 2);
popUp.VerticalOffset = (this.ActualHeight / 2) + (progressScreen.ActualHeight / 2);
popUp.HorizontalOffset = (this.ActualWidth - progressScreen.ActualWidth) / 2;
popUp.Height = this.ActualHeight;
popUp.Width = this.ActualWidth;
popUp.IsOpen = true;
【问题讨论】:
标签: windows xaml windows-phone