private static void AddRowControlToGrid(Grid grid, UIElement control)
{
grid.RowDefinitions.Add(new RowDefinition { Height = new System.Windows.GridLength(1, GridUnitType.Star) });
Grid.SetRow(control, grid.RowDefinitions.Count - 1);
grid.Children.Add(control);
}