如何在 WPF 中制作模态对话框? [英] How to make modal dialog in WPF?

查看:25
本文介绍了如何在 WPF 中制作模态对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个 Xaml 窗口,如何将它打开作为子窗口,然后让父窗口在父窗口继续执行之前等待子窗口关闭?

If I have a Xaml Window, how does one open it as a child window, and then have the parent window wait for the child to close before the parent window continues executing?

推荐答案

您是否尝试使用 ShowDialog 方法?

Did you try showing your window using the ShowDialog method?

不要忘记设置 Owner 属性 到主窗口的对话窗口.这将避免 Alt+Tabbing 等时的奇怪行为

Don't forget to set the Owner property on the dialog window to the main window. This will avoid weird behavior when Alt+Tabbing, etc.

这篇关于如何在 WPF 中制作模态对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆