- 我有个用户控件(UC1),其具有的数据上下文:ViewModelOne。
- 我有一个使用UC1作为子控件的MainWindow应用程序。
- 这个MainWindow也有一个数据上下文:ViewModelTwo。
极品属性在视图模型的数据上下文标记声明绑定,就像这样:'绑定到从在主窗口中的数据上下文子控制的ViewModels属性主窗口DataContext属性视图模型标记
<Window x:Class="control.controlnamespace"
xmlns:vm="clr-namespace"..>
<Window.DataContext>
*<vm:ViewModelTwo Property="{Binding SomeProperty, ElementName=myControl}"/>* <-- Issue Here
</Window.DataContext>
<Grid>
<UC1 x:Name="myControl"/>
</Grid>
这就是我有没有更新发生的故障,并结合不发生任何。
我还不清楚你的问题。你能用一个例子来解释吗? – Vishal 2014-11-03 18:29:40
看来,我设置在数据上下文级别的属性 Property =“{Binding SomeProperty,ElementName = myControl}”/> –
varitomiranda
2014-11-03 19:22:28