wpf - 打开窗口 C# WPF

标签 wpf windows

我有这个问题:

在 C# WPF 应用程序中:

  1. I open a new Window (showOnTaskBar=true, noresize, centered);

  2. 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();

  3. 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/

相关文章:

c# - 如何正确使用 LINQ2SQL DataContext 对象;每次使用重新创建都会让人头疼

c# - WPF - 如何以编程方式更改按钮的图像

R,Rstudio 控制台编码窗口

c++ - Windows 注册 I/O Win 8.1 RioCreateRequestQueue 错误 10045

c# - 3D View 中的 WPF 2D 动画 : Performance issue

c# - 如何以正确的方式将网格绑定(bind)到基于 EF 的 View 模型?

c# - Wpf:MediaElement 暂停并再次播放禁用速度比

c++ - 为所有用户设置注册表值

android - 如何使用 Android.bp 文件构建(Soong 构建系统)

c - 使用 Win32 API 安全删除 USB 驱动器?