diff --git a/Fleux/UIElements/Grid/Grid.cs b/Fleux/UIElements/Grid/Grid.cs index 7db6c40..728426d 100644 --- a/Fleux/UIElements/Grid/Grid.cs +++ b/Fleux/UIElements/Grid/Grid.cs @@ -63,12 +63,13 @@ public void RelocateCells() int y = this.Location.Y.ToPixels(); for (var row = 0; row < this.rows.Count(); row++) { - this.cells.Where(c => (c.Column == column) && (c.Row == row)).ToList() - .ForEach(c => - { - c.Content.Location = new Point(x, y); - c.Content.Size = new Size(this.Columns[column].Value, this.Rows[row].Value); - }); + this.cells.Where(c => (c.Column == column) && (c.Row == row)).ToList().ForEach(c => + { + c.Content.Location = new Point(x, y); + var cw = this.Columns.Skip(column).Take(c.ColumnSpan).Sum( (it) => it.Value ); + var ch = this.Rows.Skip(row).Take(c.RowSpan).Sum( (it) => it.Value ); + c.Content.Size = new Size(cw, ch); + }); y += this.Rows[row].Value; } x += this.Columns[column].Value;