I want to set a component height to "*"
dynamically in code. How can I do that?
I know how to set it to a defined value:
DataGrid.Height = "500";
And how to set to "Auto":
DataGrid.Height = Double.NaN;
Star sizing only exists for very few components, the Grid
itself is not one of them. GridLength
has a constructor which takes the type of the sizing sheme as parameter.
If you want a component to stretch do not set any value for Width
/Height
and make sure the Horizontal
/VerticalAlignment
is Stretch
.