我如何获得这个绑定表达式?

时间:2013-07-17 17:26:57

标签: c# .net wpf xaml

以下是我的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的{​​{1}},我执行了以下操作:

NameBox

1 个答案:

答案 0 :(得分:1)

尝试将UpdateSourceTrigger更改为 PropertyChanged ,然后Tel属性应具有该值。