WPF中Datagrid控件添加行号
程序员文章站
2022-03-23 12:44:01
1 /// 2 /// 导入Excel文件按钮 3 /// 4 /// 5 /// 6 private void InputExcelFile_Click(object sender, RoutedEventArgs e) 7 { 8 //将数... ......
1 /// <summary> 2 /// 导入excel文件按钮 3 /// </summary> 4 /// <param name="sender"></param> 5 /// <param name="e"></param> 6 private void inputexcelfile_click(object sender, routedeventargs e) 7 { 8 //将数据绑定到datagird控件中 9 datagridsheet.itemssource = readbynpoi.inputworkbookfromexcel(getexcelfilepath()); 10 datagridsheet.headersvisibility = datagridheadersvisibility.row; 11 datagridsheet.rowheaderwidth = 30; 12 //loadingrow事件 13 datagridsheet.loadingrow += datagridsheet_loadingrow; 14 } 15 16 private void datagridsheet_loadingrow(object sender, datagridroweventargs e) 17 { 18 e.row.header = e.row.getindex() + 1;//递增行号 19 }
上一篇: Pycharm2017版本设置启动时默认自动打开项目的方法
下一篇: C#列表页面后台代码