[c#] 代码背后的网格星大小


Answers

grid.RowDefinitions[0].Height = new GridLength(0.5, GridUnitType.Star);
Question

我有一个网格如下,

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="0.5*" />
        <RowDefinition Height="0.5*" />
    </Grid.RowDefinitions>
</Grid>

如何在代码中给出Height = "0.5*"




Related



Tags

c# c#   wpf   xaml   grid