Вопрос

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 tree?

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top