このような列にaCheckBox
と aを一緒に入れたい: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"
。
どうやってやるの?