2台のモニターを持っています。アプリケーションを実行すると、親が最初のモニターに表示されます。親ウィンドウを 2 番目のモニターに移動してボタンをクリックすると (読み込み用の xaml ウィンドウを表示)、この子ウィンドウは最初のモニターに残ります。親ウィンドウがどこにあるかに関係なく、子ウィンドウを親ウィンドウにとどめる方法はありますか?
注意してください: 親は winform ... 子は xaml です。
xaml のロード (子)
<Window x:Class="Test.Loading"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
WindowStyle="None"
AllowsTransparency="True"
WindowState="Maximized"
Background="Gray">
<Grid>
<Border>
<TextBlock Text="Loading ..." />
</Border>
</Grid>
</Window>
親
private void btnShowLoading_Click(object sender, EventArgs e)
{
Loading load = new Loading();
double top = this.Top;
double left = this.Left;
load.Top = top;
load.Left = left;
load.Show();
}