WPF DataGrid行序号自增-技术&分享

WPF DataGrid行序号自增


构造函数添加如下代码:

PackageDetailsGrid.LoadingRow += new EventHandler<Microsoft.Windows.Controls.DataGridRowEventArgs>(dataGrid_LoadingRow);

函数定义如下:

public void dataGrid_LoadingRow(object sender, Microsoft.Windows.Controls.DataGridRowEventArgs e)
{
     e.Row.Header = e.Row.GetIndex() + 1;    //设置行表头的内容值  
}


发布了40 篇原创文章 · 获赞 4 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/jackson0714/article/details/25144779
今日推荐