I am currently add datagrid column automatically
Such as:
dgForData.Columns.Add(new System.Windows.Controls.DataGridTextColumn() { Header = getData.DataPrice, Binding = new System.Windows.Data.Binding(getData.DataFiledPrice) });
dgForData.Columns.Add(new System.Windows.Controls.DataGridCheckBoxColumn() { Header = getData.DataIsCabinetContains, Width = DataGridLength.Auto, Binding = new System.Windows.Data.Binding(getData.DataFiledIsCabinetContains) });
I want to add a checkBox in the column next to the title, and you can use it to achieve the click event Select function, but I do not know how to add.
[edit]Code block corrected[/edit]
In front of the wrong word, I asked the title plus checkBox
such as
<DataGridTemplateColumn Width="0.3*">
<DataGridTemplateColumn.Header>
<CheckBox x:Name="CbTeacherDevice" Content="序号">
</CheckBox>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox Margin="12,0,0,0"></CheckBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
Just about the form, but I want to add this column is dynamic