开发者

Listening to routed events / commands from a popup

开发者 https://www.devze.com 2023-04-06 10:34 出处:网络
I have a control that dynamically creates a popup. The popup contains controls that fire routed events / commands, which I want to react to in the original control. The original control is set as the

I have a control that dynamically creates a popup.

The popup contains controls that fire routed events / commands, which I want to react to in the original control. The original control is set as the placement target of the popup.

Would you expect the original control to receive bubbled events? I know it's in a different visual tree, but I wondered whether they would be offered to the placement target. From my code it would appear not.

Can anyone suggest a way to handle this situation? Responding to events in a different visual tree. I was wondering if there was some control I could write that would sit in the root of the popup and act as a "bridge" into the originating visual tr开发者_如何学JAVAee?

Many thanks,


I have managed to get around this by adding my CommandBinding to the popup's CommandBindings collection instead of my control's.

As I do this in code at the point of the popup's creation, I can specify callbacks in my control, even though the binding is in the popup.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号