如何阻止子窗口继承父窗口上的 WPF TopMost 标志
我有一个具有 TopMost=true 的 WPF 窗口。当我从此窗口调用另一个窗口并将最顶层窗口指定为父窗口时,拥有的窗口也显示为最顶层。
我想找到一种方法来阻止这种情况发生,以便我的父母仍然可以拥有孩子,但孩子没有 TopMost=True。
我知道我可以不费心去设置子窗口的所有者,这样我就不会得到 TopMost 标志,但我需要所有窗口都与父窗口一起关闭,并编写逻辑来处理这似乎是一种浪费包括。
我尝试在子级加载后显式设置 TopMost=False ,但没有运气,如果所有者窗口是 TopMost 似乎并不重要,那么无论我对它的 TopMost 属性做什么,子级都将是。
有什么想法吗?
I have a WPF window that has TopMost=true . When I call another Window from this window and specify the topmost window as the parent the owned window also displays as TopMost.
I would like to find a way to stop that from happening so that my parent can still own the child yet the child does not have TopMost=True.
I know I can just not bother to set the owner on the child then I won't get the TopMost flag, but I need all my windows to close with the parent window and writing the logic to handle that seems like a waste when it is included.
I've tried to explicitly set the TopMost=False after the child was loaded but no luck, it doesn't seem to matter if the owner window is TopMost then the child will be no matter what I do to it's TopMost property.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在运行时设置(父)窗口的最顶层。 (并且不是默认情况下)
Set The TopMost of the (parent) window, at runtime. (and not by default)