■ 뷰 내에서 모든 데이터 행 핸들을 수집하는 방법을 보여준다. (숨겨진 행 포함)
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
using System.Collections.Generic; using DevExpress.Xpf.Grid; #region 데이터 행 핸들 리스트 구하기 - GetDataRowHandleList(gridControl) /// <summary> /// 데이터 행 핸들 리스트 구하기 /// </summary> /// <param name="gridControl">GridControl 객체</param> /// <returns>데이터 행 핸들 리스트</returns> public List<int> GetDataRowHandleList(GridControl gridControl) { List<int> rowHandleList = new List<int>(); for(int i = 0; i < gridControl.VisibleRowCount; i++) { int rowHandle = gridControl.GetRowHandleByVisibleIndex(i); if(gridControl.IsGroupRowHandle(rowHandle)) { if(!gridControl.IsGroupRowExpanded(rowHandle)) { rowHandleList.AddRange(GetDataRowHandleListInGroup(gridControl, rowHandle)); } } else { rowHandleList.Add(rowHandle); } } return rowHandleList; } #endregion #region 그룹에서 데이터 행 핸들 리스트 구하기 - GetDataRowHandleListInGroup(gridControl, groupRowHandle) /// <summary> /// 그룹에서 데이터 행 핸들 리스트 구하기 /// </summary> /// <param name="gridControl">GridControl 객체</param> /// <param name="groupRowHandle">그룹 행 핸들</param> /// <returns>그룹에서 데이터 행 핸들 리스트</returns> public List<int> GetDataRowHandleListInGroup(GridControl gridControl, int groupRowHandle) { List<int> rowHandleList = new List<int>(); for(int i = 0; i < gridControl.GetChildRowCount(groupRowHandle); i++) { int rowHandle = gridControl.GetChildRowHandle(groupRowHandle, i); if(gridControl.IsGroupRowHandle(rowHandle)) { rowHandleList.AddRange(GetDataRowHandleListInGroup(gridControl, rowHandle)); } else { rowHandleList.Add(rowHandle); } } return rowHandleList; } #endregion |