如何使模式对话框在WPF? [英] How do make modal dialog in WPF?

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

问题描述

我写在WPF我的第一个应用程序,并希望有用户输入一些数据,在一个模式对话框窗口。显然,这不是简单的事在WPF,因为父窗口保持完全启用,并创造了新的子窗口不会停下来等待的子窗口调用Close()的方法。相反,它只是不断向前发展。这不是我想要的。

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?

推荐答案

你有没有试出了使用的的ShowDialog 方法?

Did you try showing your window using the ShowDialog method?

不要忘了业主财产上的对话窗口设置。这将避免怪异的行为时,Alt + Tab键等。

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

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

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