我们可以为弹出窗口设置WindowOpenEvent/WindowClosedEvent吗 [英] Can we have WindowOpenEvent/WindowClosedEvent for Popup

查看:128
本文介绍了我们可以为弹出窗口设置WindowOpenEvent/WindowClosedEvent吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为WPF提供自动化支持,现在我们遇到了有关弹出窗口的打开/关闭事件的问题.那是:

I am palying around automation support for WPF and now we get a problem about the open/close event for popup. That is:


推荐答案

Clark,我不太确定您所说的弹出窗口"是什么意思.您能举个例子吗?

通常,WPF本身会提供有关打开和关闭窗口的事件.如果要在WPF应用程序中创建新元素,但不是真正的窗口,则可以使用RaiseStructureChangedEvent()并将StructureChangeType设置为StructureChangeType.ChildAdded.此事件表明内部结构已通过添加新元素而发生了变化,这听起来像您在做什么.摆脱弹出窗口后,请使用ChildRemoved触发结构更改.
Clark, I'm not quite sure what you mean by a "popup."  Can you give me an example?

In general, WPF itself provides the events for when windows are opened and closed.  If you are creating elements in your WPF application that are new, but aren't real windows, you can use RaiseStructureChangedEvent() and set the StructureChangeType to StructureChangeType.ChildAdded.  This event indicates that the internal structure has changed by the addition of a new element, which sounds like what you are doing.  When you get rid of the popup, fire a structure change with ChildRemoved.


这篇关于我们可以为弹出窗口设置WindowOpenEvent/WindowClosedEvent吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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