WPF DataGrid自增ID列
第一步:DataGrid添加LoadingRow="ApplicationRunLogDataGrid_LoadingRow"
第二步:
///
/// 自增序号列
///
private void ApplicationRunLogDataGrid_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = e.Row.GetIndex() + 1;
}