<DataGrid Name="tkdg" HorizontalContentAlignment="Center" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" LoadingRow="tkdg_LoadingRow"> 。。。。。
private void tkdg_LoadingRow(object sender, DataGridRowEventArgs e) { //加载行 e.Row.Header = e.Row.GetIndex() + 1; }
LoadingRow事件会在加载 数据一行数据时发生,这里还有多种应用,比如每次加载时如果每行对象某值大于多少时行背景显示一种颜色,小于是另一种颜色等等