WPF DataGrid下的单元格嵌入CheckBox列表
<DataGrid
Width="auto"
Height="auto"
AutoGenerateColumns="False"
CanUserAddRows="False"
GridLinesVisibility="All">
<DataGrid.Columns>
<DataGridTemplateColumn Width="5*" Header="测试项">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border Background="Transparent">
<ListBox ItemsSource="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Content="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsChecked="{Binding isSelect}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
效果为: