以下是我的 XAML 代码:
<ListView ItemsSource="{Binding Path=ViewModel.Rows}"
x:Name="LView" HorizontalAlignment="Left" Height="401" Margin="10,52,0,0" VerticalAlignment="Top" Width="504">
<ListView.View>
<GridView>
<GridViewColumn x:Name="Expressions"
Width="250"
Header="Expression"
DisplayMemberBinding="{Binding Expression}">
</GridViewColumn>
<GridViewColumn x:Name="Tele"
Width="50"
Header="In Tele?">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox x:Name="telCheck"
DataContext="{Binding}"
IsEnabled="True"
IsChecked="{Binding Path=Tel, UpdateSourceTrigger=Explicit}"></CheckBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
如何获取telCheck
(即复选框的isChecked
属性)的绑定表达式?在我的代码前面,对于一个TextBox
命名的NameBox
,我做了以下事情:
var be = NameBox.GetBindingExpression(TextBox.TextProperty);
be.updateSource();