I have a WPF user control. It contains several Expanders separated with GridSplitters. In the code below, you can see that the second Expander contains a TabControl Items. One of the tabs has a DataGrid. My problem is that when that Expander is expanded, and not all records fit the MaxHeight of 200 (see code below), the scroll is not visible. It does appear when I move the GridSplitter below the Expander, but how can I make it show up without that extra action?
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="4"></RowDefinition>
<RowDefinition Height="Auto" MaxHeight="200"></RowDefinition>
<RowDefinition Height="4"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,3">
...
</StackPanel>
...
<Expander Grid.Row="2" IsExpanded="False" Header="Gathered File History">
...
</Expander>
<GridSplitter Grid.Row="3"
Height="4"
Background="Gray"
HorizontalAlignment="Stretch"></GridSplitter>
<Expander Grid.Row="4" IsExpanded="True" Header="Data Analysis: Detail Queries">
<TabControl x:Name="Items" >
...
</TabControl>
</Expander>
<GridSplitter Grid.Row="5"
Height="4"
Background="Gray"
HorizontalAlignment="Stretch"></GridSplitter>
<Expander Grid.Row="6" IsExpanded="True" Header="Source Detail Records">
...
</Expander>
</Grid>
@DavidShochet you are right about the cause.
It happens because the grid auto size is constrained to its content size so if the tab is growing so is the grids row, on the other hand DockPanel is constrained to its parent size. That’s why you should set its max size to 200.