简体   繁体   English

是否可以找到View Model引用的属性

[英]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.

相关问题 如何在 mvc4 中的同一视图中访问不同的模型属性? 有可能吗? - How to access different model properties in same view in mvc4?Is it possible? 如果将剃刀视图引用到视图模型而不是模型,则jQuery calender无法正常工作 - Jquery calender is not working if the razor view is referenced to a view model instead of a model 视图模型的属性未在HttpPost上设置 - properties of View Model are not set on HttpPost 找不到视图模型的视图 - Cannot find view for view model 在视图中循环浏览视图模型属性 - Looping through view Model properties in a View 是否可以在 View 中使用 ValueTuple 作为模型? - Is it possible to use ValueTuple as model in View? 是否可以忽略部分视图的模型? - Is it possible to ignore model for partial view? 模型属性的属性通过视图模型查看 - 如何? - Attributes of model properties goes to view through view model - how to? 是否可以从 ValidationAttribute 中的不同模型访问属性 - Is it possible to access properties from a different model in a ValidationAttribute 是否可以将模型类的属性绑定到ComboBox? - Is it possible to bind properties of a model class to a ComboBox?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM