0
我想將彈出窗口正好居中在屏幕中央。 我已經使用Usercontrol在彈出窗口中顯示。 但是,我計算HorizontalOffset和垂直偏移的方式是錯誤的。居中彈出窗口/用戶控件
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;