c#wpf基于应用程序打开新窗口

c#wpf基于应用程序打开新窗口,c#,wpf,window,C#,Wpf,Window,我想问一下,是否可以打开与主应用程序相关的新窗口?目前我正在使用System.Windows.Window.Left/Right 但它只与桌面有关 谢谢。您可以使用WindowsStartUpLocation属性设置窗口的显示位置 在XAML中 <Window WindowStartupLocation="CenterParent"> 或者你可以设置如下 this.Left = mainWindow.Left + (mainWindow.Width - this.ActualWid

我想问一下,是否可以打开与主应用程序相关的新窗口?目前我正在使用
System.Windows.Window.Left/Right
但它只与桌面有关


谢谢。

您可以使用WindowsStartUpLocation属性设置窗口的显示位置

在XAML中

<Window WindowStartupLocation="CenterParent">
或者你可以设置如下

this.Left = mainWindow.Left + (mainWindow.Width - this.ActualWidth) / 2;
this.Top = mainWindow.Top + (mainWindow.Height - this.ActualHeight) / 2;

您可以使用WindowsStartUpLocation属性设置窗口应显示的位置

在XAML中

<Window WindowStartupLocation="CenterParent">
或者你可以设置如下

this.Left = mainWindow.Left + (mainWindow.Width - this.ActualWidth) / 2;
this.Top = mainWindow.Top + (mainWindow.Height - this.ActualHeight) / 2;

一个简单的方法是使用主窗口的位置。大概是这样的:

OtherWindow other = new OtherWindow();
other.Top = mainWindow.Top + 20;

一个简单的方法是使用主窗口的位置。大概是这样的:

OtherWindow other = new OtherWindow();
other.Top = mainWindow.Top + 20;

你能准确地说出你所说的“关系”是什么意思吗?那是关于职位的吗?是的,是关于职位的。你能准确地说出你所说的“关系”是什么意思吗?这是关于位置的吗?是的,是关于位置的。但是有可能根据坐标来做吗?比如我的应用程序的(0,0)中的10 X和10 Y?但是有可能根据坐标来做吗?比如我的应用程序(0,0)中的10 X和10 Y?