我在运行时用内容动态填充两个堆栈面板,我想通过百分比设置这两个堆栈面板的高度。这是我尝试过的:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="3*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<ScrollViewer HorizontalAlignment="Stretch"
Grid.Row="0">
<StackPanel Name="gridEvents"
Orientation="Vertical"
HorizontalAlignment="Stretch">
<Label Content="Foo" />
</StackPanel>
</ScrollViewer>
<ScrollViewer HorizontalAlignment="Stretch"
Grid.Row="1">
<StackPanel Name="gridNewEvent"
Orientation="Vertical"
HorizontalAlignment="Stretch">
<Label Content="Bar" />
</StackPanel>
</ScrollViewer>
</Grid>
如果我将 RowDefinition 高度更改为静态值,它会起作用。但不是当我尝试百分比时。有任何想法吗?