Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

Scrollview does not resize when ContentSize changes when inside a Detail page #1332

Closed
@mattclarkie

Description

@mattclarkie

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

  1. Create a MasterDetailPage
  2. Assign a Page to the Detail (not a NavigationPage)
  3. Add a Scrollview to the Page
  4. Add a StackLayout to the Scrollview
  5. Add 2 or more Layouts to the StackLayout with some content
  6. 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

  1. Run the Reproduction
  2. Hit top Expand/Collapse and the red box will disappear/appear and the layout will adjust correctly
  3. Choose Page 1 in the navigator
  4. 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:

Reproduction Link

AndroidScrollviewIssue.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.4.0regression on 2.4.0a/mdpa/scrollviewe/5 🕔5excellent-reporthelp wantedWe welcome community contributions to any issue, but these might be a good place to start!i/regressionm/high impact ⬛p/Androids/needs-info ❓A question has been asked that requires an answer before work can continue on this issue.t/bug 🐛up-for-grabsWe welcome community contributions to any issue, but these might be a good place to start!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions