/// <summary> /// Add a new row in grid at the end of the row list /// </summary> /// <param name="row"></param> public void AddRow(Row row) { GridObj.Add(row); }
/// <summary> /// Inserts a new row in the grid at the specified index /// </summary> /// <param name="index"></param> /// <param name="row"></param> public void InsertRow(int index, Row row) { if (index < 0 || index >= RowCount) throw new ArgumentOutOfRangeException( "Invalid Index value: must be greater than or equal to zero and less than Row count"); GridObj.Insert(index, row); }
/// <summary> /// Setup grid by using row and column count /// </summary> /// <param name="rows"></param> /// <param name="columns"></param> private void Setup(int rows, int columns) { if (rows <= 0 || columns <= 0) throw new ArgumentOutOfRangeException("Row and Column size must be greater than zero"); GridObj = new List<Row>(); for (int i = 0; i < rows; i++) { Row row = new Row(); for (int j = 0; j < columns; j++) { Cell cell = new Cell(false); row.AddCell(cell); } GridObj.Add(row); } ColumnCount = columns; RowCount = rows; }