25

I create some control in codebehind and would like to set its size dynamically. I can assign numerical values as well as System.Windows.GridLength.Auto, but there is no equivalent to "*".
Is that because the "*" from XAML gets translated into code when the WPF gets parsed?

To give this some detail: There is a grid with three rows. I want the top and bottom row to take all the space they can, while the middle row remains auto-sized.

Jonas
  • 121,568
  • 97
  • 310
  • 388
Martin Hennings
  • 16,418
  • 9
  • 48
  • 68

1 Answers1

58
var gridLength = new GridLength(1, GridUnitType.Star);

More info.

Eugene Cheverda
  • 8,760
  • 2
  • 33
  • 18