这里我举报一个警报示例:
从图片中可以看出,我无法将警报窗口置于任务栏上方。
这是我设置窗口poszione的代码:
public new void Show()
{
this.Left = Application.Current.MainWindow.Left +
Application.Current.MainWindow.ActualWidth - this.Width;
this.Top = Application.Current.MainWindow.Top +
Application.Current.MainWindow.ActualHeight - this.Height;
this.Topmost = true;
Application.Current.MainWindow.Dispatcher.BeginInvoke(
System.Windows.Threading.DispatcherPriority.ApplicationIdle,
(System.Threading.ThreadStart)delegate()
{
base.Show();
});
}
答案 0 :(得分:0)
您可以在 SystemParameters 中使用一些有用的信息来正确找到窗口。具体而言,您需要获得SystemParameters.WorkArea.Bottom
。代码应该是这样的:
this.Left = SystemParameters.WorkArea.Right - this.ActualWidth;
this.Top = SystemParameters.WorkArea.Bottom - this.ActualHeight;