从WPF中的另一个窗口关闭窗口 [英] Close window from another window in WPF

查看:67
本文介绍了从WPF中的另一个窗口关闭窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在WPF中有一个C#应用程序,我需要从另一个窗口关闭一个打开的窗口...

我该怎么办?

我想关闭从其他表单以无模式模式打开的表单.

I have a C# application in WPF and I need to close an opened window from another window ...

How can I do that?

I want to close a form that i opened in modeless mode froma another form .

推荐答案

在什么情况下?

您要关闭的表单是否由您要关闭的表单打开?

您要关闭无模式或模态表单的表单吗?

如果您想在第一时间获得正确的答案,则必须提供更多的信息.
In what context?

Was the form that you want to close was opened by the form you want to close it from?

Is the form that you want to close a modeless or a modal form?

If you want the right answer the first time, you have to provide a lot more info.


以您要关闭的形式创建一个属性,并将引用放在您要引用的表单上要关闭.

现在,在需要时关闭表单.

但是请确保子窗体未按模态打开.

:cool:
Create a property in the form you want to close from, and put the reference to the one you want to close.

Now Close the form when required.

But Make sure, that the child form is opened not modal to it.

:cool:


这篇关于从WPF中的另一个窗口关闭窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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