0
我试图让一些XAML片断更具可读性(不是生产代码,只是为了更好地理解XAML内部工作原理)。 原始代码是简写和单手WPF绑定等效
<CheckBox IsChecked="{Binding Path=IsSelected, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGridRow}}}">
我把它改成
<CheckBox>
<CheckBox.IsChecked>
<Binding Path="IsSelected" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay">
<Binding.Source>
<RelativeSource Mode="FindAncestor" AncestorType="{x:Type DataGridRow}"/>
</Binding.Source>
</Binding>
</CheckBox.IsChecked>
</CheckBox>
第一种形式的作品确定(它正确地结合的复选框容器的IsSelected属性的财产器isChecked(一DataGridRow )。 第二个不起作用。 应该如何看待正常工作?