关键代码:
class="csharpcode"> /// <summary> /// 删除全部行 /// </summary> /// <param name="gridView">GridView</param> public static void ClearRows(this GridView gridView) { bool _mutilSelected = gridView.OptionsSelection.MultiSelect;//获取当前是否可以多选 if (!_mutilSelected) gridView.OptionsSelection.MultiSelect = true; gridView.SelectAll(); gridView.DeleteSelectedRows(); gridView.OptionsSelection.MultiSelect = _mutilSelected;//还原之前是否可以多选状态 }
代码使用:
gcLampConfig.UIThread<GridControl>(gc => gvLampConfig.ClearRows());