C#C
C#3y ago
Anton

❔ Preventing a panel from overflowing + show scrollbar WPF

I have a situation like this
<StackPanel>
  <Grid>
    some buttons
  </Grid>
  <StackPanel> possibly wrapped in ScrollViewer?
    variable height content that may not fit
  </StackPanel>
</StackPanel>

The problem is that the bottom panel overflows on the y axis. Solutions online suggest setting it to the width of the container like here https://stackoverflow.com/questions/47333220/wpf-scrollviewer-content-overflowing which I obviously can't do. How do I hide the overflow? I want it to take all available space on the Y axis, but no more than the screen height.
Stack Overflow
I have a WPF control with this basic structure:

<Grid>
<ScrollViewer x:Name="_Scroll" Grid.Row="4" Grid.RowSpan="20" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="
Was this page helpful?