从弹出窗口监听路由事件/命令

发布于 2024-12-05 22:00:22 字数 243 浏览 3 评论 0原文

我有一个动态创建弹出窗口的控件。

弹出窗口包含触发路由事件/命令的控件,我想在原始控件中对其做出反应。原始控件被设置为弹出窗口的放置目标。

您希望原始控件接收冒泡事件吗?我知道它位于不同的视觉树中,但我想知道它们是否会提供给展示位置目标。从我的代码看来不是。

谁能建议一种方法来处理这种情况?响应不同视觉树中的事件。我想知道是否可以编写一些控件,将其置于弹出窗口的根部并充当原始视觉树的“桥梁”?

非常感谢,

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,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

说谎友 2024-12-12 22:00:23

我通过将 CommandBinding 添加到弹出窗口的 CommandBindings 集合而不是控件的 CommandBinding 集合中,设法解决了这个问题。

当我在创建弹出窗口时在代码中执行此操作时,我可以在控件中指定回调,即使绑定位于弹出窗口中也是如此。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文