private void UpdateGrid(GridContent content, Index2D idx) { var widthDef = content.WidthDef; var heightDef = content.HeightDef; // Validate Spans if (idx.X + widthDef.Span > ColumnCount) { throw new ArgumentException("Column span is out of bound"); } if (idx.Y + heightDef.Span > RowCount) { throw new ArgumentException("Row span is out of bound"); } // Insert content for (int i = idx.X; i < idx.X + widthDef.Span; i++) { for (int j = idx.Y; j < idx.Y + heightDef.Span; j++) { // TODO: Implement auto for containers if (content.IsContent == false && (Columns[i].IsAuto || Rows[j].IsAuto)) { throw new NotImplementedException("Auto not implemented for containers"); } Grid[i, j] = content; } } }
private void InitializeGrid() { Grid = new GridContent[RowCount, ColumnCount]; RowsData = Enumerable.Repeat(new VectorData(), RowCount).ToArray(); ColumnsData = Enumerable.Repeat(new VectorData(), ColumnCount).ToArray(); }