我有很多可以通过键盘或后端更新的单元格。在通过后端更新第一个工作期间,第二个工作。为什么? 在第二个中,我试图简化强制datacontext的绑定。
<UI:ReadWriteCell Grid.Column="22" Grid.Row="0"
IsReadOnly="{Binding ElementName=OreProduzioneViewCtl,Path=Giorno.H23.Data,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource GiornoPassato}}"
Text="{Binding ElementName=OreProduzioneViewCtl,Path=Giorno.H23.PotenzaModificabile,Mode=TwoWay,UpdateSourceTrigger=LostFocus,Converter={StaticResource PotenzaModificabile}}"/>
<UI:ReadWriteCell Grid.Column="23" Grid.Row="0" DataContext="{Binding ElementName=OreProduzioneViewCtl,Path=Giorno.H24,UpdateSourceTrigger=PropertyChanged}"
IsReadOnly="{Binding Path=Data,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource GiornoPassato}}"
Text="{Binding Path=PotenzaModificabile,Mode=TwoWay,UpdateSourceTrigger=LostFocus,Converter={StaticResource PotenzaModificabile}}"/>
答案 0 :(得分:0)
MSDN说&#34; FrameworkElement.DataContext属性&#34;
获取或设置元素参与数据绑定时的数据上下文。
和
XAML值
dataContextObject
直接嵌入的对象,用作父元素中任何绑定的数据上下文。通常,此对象是Binding或另一个BindingBase派生类。或者,可以将此处用于绑定的任何CLR对象类型的原始数据放在此处,稍后定义实际绑定。
bindingUsage
评估为适当数据上下文的绑定用法
resourceExtension
以下之一:StaticResource或DynamicResource。当引用定义为资源中的对象的原始数据时,将使用此用法。
contextResourceKey
在ResourceDictionary中请求对象的密钥标识符。
https://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.datacontext(v=vs.110).aspx