<DataGridTemplateColumn Header="选择" Width="Auto" > <!--列头模板--> <DataGridTemplateColumn.HeaderTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="选择" FontSize="15"></TextBlock> <CheckBox x:Name="DepPatientCheckBox" Margin="10,0,0,0" Click="SelectAllPatientInDep"></CheckBox> </StackPanel> </DataTemplate> </DataGridTemplateColumn.HeaderTemplate> <!--单元格模板--> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <CheckBox Name="ckbItem" IsChecked="{Binding IsCheckBinding,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Click="CkbItem_OnClick" HorizontalAlignment="Center"></CheckBox> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn>
转载于:https://www.cnblogs.com/Lulus/p/8158400.html