ColumnDefinition cd0 = new ColumnDefinition(); cd0.Width = new GridLength(2, GridUnitType.Star); txtGrid.ColumnDefinitions.Add(cd0);