如何在WPF中进行模态对话? [英] How do make modal dialog in WPF?
问题描述
如何让子窗口打开,让父窗口等待孩子关闭,然后父窗口继续执行?
您是否尝试使用 ShowDialog 方法?
不要忘记设置所有者对话窗口上的属性。当Alt + Tabbing等等
时,这将避免奇怪的行为
I am writing my first application in WPF and want to have the user input some data on a modal dialog window. Apparently, this is not simple to do in WPF, because the parent window stays fully enabled, and the method that created the new child window doesn't stop and wait for the child window to call Close(). Instead it just keeps going forward. This is not what I want.
How can I get the child window to open, and have the parent window wait for the child to close before the parent window continues executing?
Did you try showing your window using the ShowDialog method?
Don't forget to set the Owner property on the dialog window. This will avoid weird behavior when Alt+Tabbing, etc.
这篇关于如何在WPF中进行模态对话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!