I have a control in a grid row with height set to auto. the control's max height is bound to the actual height of the grid. This is so that the control will resize depending on it's content, but then not grow outside of the size of the grid if there is lots of data - it just gets a scroll bar. This works perfectly fine.
The issue is when I resize the window. If i make the window smaller than the size of the control, then the control doesn't resize to fit in the window.
If I then (with the smaller window size) close the screen and open it back up, the control resizes to the correct size.
When going from a smaller size to a larger size, the control expands to take up more space. It just doesn't resize to take up less space when going from a larger size to a smaller size
<Grid x:Name="MyGrid">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ScrollViewer MaxHeight="{Binding ElementName=MyGrid, Path=ActualHeight}">
<TextBlock Background="Gray" Text="Hello World" Height="700"/>
</ScrollViewer>
</Grid>
When shrinking the window, I expect the control to shrink, but it stays the same height and stays partially off screen