public void InsertCell(int index, ItemGridDataCell cell) { if (cell.Data == null) { if (DataCells.Count > 0) { cell.SetData(DataCells[DataCells.Count - 1].Data); } } if (cell.Data is T || cell.Data == null) { cell.ParentGrid = ParentGrid; cell.Row = Row; cell.Colomn = index; _dataCells.Insert(index, cell); UpdateColumnNums(); } else { throw new Exception("Cell Data Type: " + cell.Data.GetType().ToString() + " does not match the Row Data Type: " + typeof(T).ToString()); } }
/// <summary> /// Adds a cell to the datagrid list, sets the cells parentGrid, Row, and Column. /// </summary> /// <param name="cell"></param> public void AddCell(ItemGridDataCell cell) { if (cell.Data == null) { if (DataCells.Count > 0) { cell.SetData(DataCells[DataCells.Count - 1].Data); } } if (cell.Data is T || cell.Data == null) { cell.ParentGrid = ParentGrid; cell.Row = Row; cell.Colomn = _dataCells.Count; _dataCells.Add(cell); FooterCell.Colomn = _dataCells.Count + 1; } else { throw new Exception("Cell Data Type: " + cell.Data.GetType().ToString() + " does not match the Row Data Type: " + typeof(T).ToString()); } }