public MarkdownTable(IEnumerable<UIElement> headers, IEnumerable<IEnumerable<UIElement>> body)
{
this.InitializeComponent();
int x = 0, y = 0;
theGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
foreach (var header in headers)
{
theGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
header.SetValue(Grid.ColumnProperty, x);
header.SetValue(Grid.RowProperty, y);
theGrid.Children.Add(header);
x++;
}
foreach (var row in body)
{
theGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
x = 0;
y++;
foreach (var column in row)
{
column.SetValue(Grid.ColumnProperty, x);
column.SetValue(Grid.RowProperty, y);
theGrid.Children.Add(column);
x++;
}
}
}
}