如何漂亮地结合使用GridSplitter
和Expander
,同时尊重上下两个区域的MinHeight
?
例如:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" MinHeight="200" /> <!-- Main -->
<RowDefinition Height="Auto" /> <!-- GridSplitter -->
<RowDefinition Height="Auto" /> <!-- Expander -->
</Grid.RowDefinitions>
<ListBox>
<ListBoxItem>A</ListBoxItem>
<ListBoxItem>...</ListBoxItem>
</ListBox>
<GridSplitter Grid.Row="1" Height="3" HorizontalAlignment="Stretch" />
<Expander Grid.Row="2" Header="Expander" IsExpanded="False">
<ListBox MinHeight="150">
<ListBoxItem>X</ListBoxItem>
<ListBoxItem>...</ListBoxItem>
</ListBox>
</Expander>
</Grid>
如果我不使用
Expander
,GridSplitter
可以正常工作,并且尊重两个行定义的MinHeight
属性。如果我不使用
GridSplitter
(并将第二个MinHeight
属性移动到第二行定义中),Expander
可以正常工作。但是当两者都被使用时,
MinHeight
属性就不能被尊重,Expander
就不能正常工作了。是否有一个简单的解决方法?