[英]Is it possible to find View Model referenced properties
I'm using Caliburn.Micro for some time now on my project (WPF) and I'm wondering if it is possible to use "Find All Reference" from View Model to get control(s) (button,combobox,textbox) that is referencing property (without going CTRL+F through View)? 我在项目(WPF)上使用了Caliburn.Micro一段时间了,我想知道是否可以使用View Model中的“查找所有引用”来获取控件(按钮,组合框,文本框)是引用属性(不通过View进行CTRL + F)? I know that there is design time support ( http://caliburnmicro.com/documentation/design-time ) if you want to jump from View to ViewModel but is it possible to jump from View Model to View in similar fashion?
我知道,如果您想从View跳转到ViewModel,可以使用设计时间支持( http://caliburnmicro.com/documentation/design-time ),但是是否可以以类似的方式从View Model跳转到View?
Not likely since the properties that you bind in your XAML markup to are actually resolved using reflection at runtime . 不太可能,因为绑定到XAML标记中的属性实际上是在运行时使用反射来解析的。
There is at least no built-in support in Visual Studio to do this. Visual Studio至少没有内置的支持来执行此操作。
The view model doesn't (and shouldn't) know which elements in the view that may bind to it and the compiler doesn't know either. 视图模型不(也不应该)知道视图中哪些元素可以绑定到视图模型,而编译器也不知道。
For this to work you would need some plugin that tries to resolve the binding paths based on the DataContext at design time (when you initialize the "Find all references" command). 为此,您需要一些插件,这些插件会在设计时(初始化“查找所有引用”命令时)尝试基于DataContext解析绑定路径。 Again, Visual Studio doesn't do this.
同样,Visual Studio不会执行此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.