I have a UserControl in my WPF application which needs to have 3 Expander controls oriented Vertically.
<Grid Margin="0,-3,0,0" Height="430" Width="Auto">
<Grid.RowDefinitions/>
<ScrollViewer>
<StackPanel Height="430" ScrollViewer.VerticalScrollBarVisibility="Auto">
<Expander Grid.Row="0" Margin="0,5,0,0" MinHeight="0" MaxHeight="220" Height="Auto" Header="Auto Create Well Pad" OpacityMask="#FFECF5F5">
<Grid Margin="5,5">
...
</Grid>
</Expander>
<Expander Grid.Row="1" Margin="0,5,0,0" Height="Auto" Header="Scenario well pads" OpacityMask="#FFECF5F5">
<WrapPanel Margin="0,5,0,0" OpacityMask="#FFECF5F5" VerticalAlignment="Top">
...
</WrapPanel>
</Expander>
<Expander Grid.Row="2" Margin="0,5,0,5" Height="Auto" Header="Project Well Pads" IsExpanded="{Binding ShowAvailablePads}" OpacityMask="#FFECF5F5">
</Expander>
</StackPanel>
</ScrollViewer>
</Grid>
With the above XAML code, the scroll bar does appear but on expanding/collapsing the expander controls, the scroll bar does not become active.
Note: All expanders have different controls inside them and when they expand, scroll bar should become active