locked
ScrollViewer in a RowDefinition with Height="Auto"

    Question

  • I have a ScrollViewer in a Grid with <RowDefinition Height="Auto"/>. However, I am having trouble making it stay in the position the user attempts to scroll it to (it just slides right back to where it was). If I explicitly set the Height attribute of the ScrollViewer to a specific value, it seems to work, but because the Xaml in the row(s) above and below the ScrollViewer are not always the same, that is somewhat inefficient. How can I use Xaml to automatically set the height of the ScrollViewer (make it use the full height of the row in the Grid)? Thanks.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Sunday, June 29, 2014 1:26 AM

Answers

  • I think I found the problem, I just needed to reverse my Auto/* values to
    <Grid.RowDefinitions>
    	<RowDefinition Height="Auto"/>
    	<RowDefinition Height="*"/>
    	<RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    

    And then it seemed to be good enough. I guess it's just confusing to make something choose it's own size when it can have as much as it wants…

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Sunday, June 29, 2014 1:55 AM