public override Control Generate(DynamicLayout layout) { if (rows.Count == 0) { return(null); } int cols = rows.Where(r => r != null).Max(r => r.Items.Count); if (Container == null) { Container = new Panel(); this.Layout = new TableLayout(Container, cols, rows.Count); } else { this.Layout = new TableLayout(null, cols, rows.Count); layout.SetBaseInnerLayout(); } var tableLayout = this.Layout; var padding = this.Padding ?? layout.DefaultPadding; if (padding != null) { tableLayout.Padding = padding.Value; } var spacing = this.Spacing ?? layout.DefaultSpacing; if (spacing != null) { tableLayout.Spacing = spacing.Value; } var scalingRow = new DynamicRow(); scalingRow.Items.Add(new DynamicControl { YScale = true }); for (int cy = 0; cy < rows.Count; cy++) { var row = rows[cy]; if (row == null) { row = scalingRow; } for (int cx = 0; cx < row.Items.Count; cx++) { var item = row.Items[cx]; if (item == null) { item = new DynamicControl { XScale = true } } ; item.Generate(layout, tableLayout, cx, cy); } } return(Container); } }
public override Control Generate (DynamicLayout layout) { if (rows.Count == 0) return null; int cols = rows.Where (r => r != null).Max (r => r.Items.Count); if (Container == null) { Container = new Panel (); this.Layout = new TableLayout (Container, cols, rows.Count); } else { this.Layout = new TableLayout (null, cols, rows.Count); layout.SetBaseInnerLayout(); } var tableLayout = this.Layout; var padding = this.Padding ?? layout.DefaultPadding; if (padding != null) tableLayout.Padding = padding.Value; var spacing = this.Spacing ?? layout.DefaultSpacing; if (spacing != null) tableLayout.Spacing = spacing.Value; var scalingRow = new DynamicRow (); scalingRow.Items.Add (new DynamicControl{ YScale = true }); for (int cy = 0; cy < rows.Count; cy++) { var row = rows[cy]; if (row == null) row = scalingRow; for (int cx = 0; cx < row.Items.Count; cx++) { var item = row.Items[cx]; if (item == null) item = new DynamicControl { XScale = true }; item.Generate (layout, tableLayout, cx, cy); } } return Container; }