我想在这样的列中有一个CheckBox
和一个:TextBlock
DataGrid
<DataGrid CanUserAddRows="False" CanUserDeleteRows="False" >
<DataGrid.Columns>
<DataGridTemplateColumn Header="one">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<TextBlock x:Name="textBlock1"></TextBlock>
<CheckBox x:Name="checkBox1"></CheckBox>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
我想将数据库中的数据绑定到此列:我在数据库字段中的数据是这样的:"0-Hello"
或"1-Bye"
如果字段是,则应取消选中并"0-hello"
应等于。checkBox1
textBlock1
"hello"
如果字段是,则应检查并"1-bye"
应等于。checkBox1
textBlock1
"hello"
我怎样才能做到这一点?