Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,710 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
private void PopulateGroup()
{
int buttonSize = ((int)(group_Button.MinHeight / myBoard.Size));
group_Button.Height = group_Button.Width;
for (int i = 1; i < myBoard.Size; i++)
{
for (int j = 1; j < myBoard.Size; j++)
{
Button b = new Button();
b.Content = string.Format("Row: {0}, Column: {1}", i, j);
Grid.SetRow(b, i);
Grid.SetColumn(b, j);
grid.Children.Add(b);
}
}
}
HI,
you can set Margin in code:
Button b = new Button() { Margin = new Thickness(5) };