我有这个问题:
在 C# WPF 应用程序中:
I open a new Window
(showOnTaskBar=true, noresize, centered);
From this opened window I open another one that is above the other opened window. The new window is without blue top bar and
showOnTaskbar=false, showDialog();
Everything is ok but if I change the focus, I mean, for example, I open Firefox or another program and then I want to go back to my opened windows I saw just the first opened window (from step 1) the other modal window comes up only with
ALT+TAB.
那么,有没有办法让两个窗口始终显示?
打开第二个窗口的代码(从步骤 1 中第一个正常打开的窗口开始):
Form2 form2 = new Form2();
formA2.ShowInTaskbar = false;
form2.ShowDialog();
谢谢你, 阿德里安
最佳答案
如果我认为您已经说过您正在从第一个窗口打开第二个窗口,那么我很确定您想尝试像这样设置对话框的所有者:
form2.Owner = Window.GetWindow(this);
参见WPF: How do I set the Owner Window of a Dialog shown by a UserControl?
希望这有帮助, 周杰伦
关于wpf - 打开窗口 C# WPF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14635663/