WPF中Datagrid控件添加行号
程序员文章站
2022-06-24 13:57:47
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 }
上一篇: 上饶幼儿师范高等专科学校2022年在专科院校中的排名
下一篇: python3基础之“函数(2)”