How to use WPF's asterisk size value in codebehind?
Asked Answered
A

1

26

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.

Addis answered 21/7, 2010 at 8:49 Comment(0)
C
59
var gridLength = new GridLength(1, GridUnitType.Star);

More info: GridUnitType enum.

Cowardly answered 21/7, 2010 at 8:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.