void InitializeCells() { for (int n = 0; n < _grid.Children.Count; n++) { var view = _grid.Children[n]; var column = _grid.GetColumn(view); var columnSpan = _grid.GetColumnSpan(view); var columnGridLengthType = GridLengthType.None; for (int columnIndex = column; columnIndex < column + columnSpan; columnIndex++) { columnGridLengthType |= ToGridLengthType(_columns[columnIndex].ColumnDefinition.Width.GridUnitType); } var row = _grid.GetRow(view); var rowSpan = _grid.GetRowSpan(view); var rowGridLengthType = GridLengthType.None; for (int rowIndex = row; rowIndex < row + rowSpan; rowIndex++) { rowGridLengthType |= ToGridLengthType(_rows[rowIndex].RowDefinition.Height.GridUnitType); } _cells[n] = new Cell(n, row, column, rowSpan, columnSpan, columnGridLengthType, rowGridLengthType); } }
void SetLocation(IGridLayout grid, IView view, int row = 0, int col = 0, int rowSpan = 1, int colSpan = 1) { grid.GetRow(view).Returns(row); grid.GetRowSpan(view).Returns(rowSpan); grid.GetColumn(view).Returns(col); grid.GetColumnSpan(view).Returns(colSpan); }