Scrollview does not resize when ContentSize changes when inside a Detail page #1332
Description
Description
When the content inside a scrollview changes size the Scrollview does not resize itself. The effect is that when content gets smaller a gap is left where the content used to be, when content gets bigger it cannot be seen. This only happens when the ScrollView is inside a Page that is the Detail of a MasterDetailPage. If the Detail is a NavigationPage then the Scrollview works correctly.
Steps to Reproduce
- Create a MasterDetailPage
- Assign a Page to the Detail (not a NavigationPage)
- Add a Scrollview to the Page
- Add a StackLayout to the Scrollview
- Add 2 or more Layouts to the StackLayout with some content
- Trigger one of the Layouts to change size, for example set it's content to IsVisible=false
In the reproduction solution mdp.xaml.cs in the PCL is the page that set the Detail, on initial load there will be a NavigationPage. To reproduce in the Reproduction
- Run the Reproduction
- Hit top Expand/Collapse and the red box will disappear/appear and the layout will adjust correctly
- Choose Page 1 in the navigator
- Repeat with the top Expand/Collapse the red box will disappear/appear but the layout will not adjust
Note, I can't remember whether the uploaded reproduction is referencing the Xamarin.Forms version that works or the one that doesn't work. Please ensure that the Xamarin.Forms references are set to 2.4.0.91020 or later.
Expected Behavior
Layout is adjusted/redrawn so controls occupy the ScrollView without leaving empty space.
Actual Behavior
Empty space is left where the (now) smaller control used to occupy. The Draw method in the ScrollViewRenderer never gets called, although the ContentSizeProperty does trigger a PropertyChanged event.
Basic Information
- Version with issue:2.4.0.91020 onwards
- Last known good version:2.3.4.270
- IDE:Visual Studio 2015 and 2017.3
- Platform Target Frameworks:
- Android:5.1.1, presumably other versions too
- Android Support Library Version: 25.4.0.2
- Nuget Packages:Xamarin.Forms
- Affected Devices: