检测何时选择设计表面上的控件
我正在编写一个 Expression Blend 4 扩展,我想检测(在我的扩展中)何时选择设计表面上的控件或元素。有人可以告诉我如何检测它吗?谢谢,蒂姆
I'm writing an Expression Blend 4 Extension and I want to detect (in my extension) when a Control or Element on the design surface is selected. Can someone tell me how I can detect it? Thanks, Tim
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我继续了我的教程编写扩展。当您查看该项目的示例代码时,下面的代码应该很清楚。
当活动文档更改时,将调用下面的第一个方法。此方法处理 IDocumentService 的 ActiveDocumentChanged 事件。首先,它从调色板注册表中获取TimelinePane的内容。此内容中包含 ActiveSceneViewModel。 ActiveSceneViewModel 是包含活动场景(= 当前正在编辑的 xaml 文件)的视图模型。 ActiveSceneViewModel 包含一组选定的元素,即 ElementSelectionSet。其中有一个事件(Changed),当它被更改时会被触发。处理这个事件。
在此事件处理程序中,您可以在更改后立即访问选择集。
I've continued a bit on my tutorial on writing extensions. When you look at the sample code of this project the code below should be clear.
The first method below is called when the active document is changed. This method handles the ActiveDocumentChanged event of the IDocumentService. First it gets the content of TimelinePane from the palette registry. In this content lives the ActiveSceneViewModel. The ActiveSceneViewModel is the viewmodel that containse the active scene (= the current xaml file being edited). The ActiveSceneViewModel contains a set of the selected elements, the ElementSelectionSet. Which has an event(Changed) that is fired when it is changed. Handle this event.
In this eventhandler you'll have access to the selection set, directly after it is changed.