Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScrollView doesn't constrain itself to a VerticalStackLayout parent whereas it does when the parent is a Grid #12523

Closed
PureWeen opened this issue Jan 9, 2023 · 2 comments
Labels
area-controls-scrollview ScrollView layout-stack p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with platform/android 🤖 platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst platform/windows 🪟 t/bug Something isn't working
Milestone

Comments

@PureWeen
Copy link
Member

PureWeen commented Jan 9, 2023

Description

Given the following two setups it feels like the two ScrollViews should both size to a height of 100 but only the Grid does.

    <Grid RowDefinitions="Auto, Auto">
        <Grid HeightRequest="100">
            <ScrollView x:Name="gridScrollView" MinimumHeightRequest="100" SizeChanged="GridSizeChanged"  Background="Green">
                <VerticalStackLayout HeightRequest="250" Background="Blue">
                    <Label Text="Layout Height" x:Name="gridLabel"></Label>
                </VerticalStackLayout>
            </ScrollView>
        </Grid>
        <VerticalStackLayout HeightRequest="100" Grid.Row="1">
            <ScrollView x:Name="vslScrollView" MinimumHeightRequest="100" SizeChanged="VSLSizeChanged" Background="Purple">
                <VerticalStackLayout HeightRequest="250" Background="Orange">
                    <Label Text="Layout Height" x:Name="vslLabel"></Label>
                </VerticalStackLayout>
            </ScrollView>
        </VerticalStackLayout>
    </Grid>

image

The height of each layout is 100. If you set the VSL to clip it'll clip the ScrollView to 100.

Steps to Reproduce

Run the attached app

Link to public reproduction project repository

MauiApp81.zip

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android, Windows, macOS

Affected platform versions

All of them

Did you find any workaround?

No response

Relevant log output

No response

@PureWeen PureWeen added t/bug Something isn't working area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter layout-stack labels Jan 9, 2023
@PureWeen PureWeen changed the title ScrollView doesn't constrain itself to a VerticalStackLayout parent whereas it does when the parent is a grid ScrollView doesn't constrain itself to a VerticalStackLayout parent whereas it does when the parent is a Grid Jan 9, 2023
@rachelkang rachelkang added this to the Backlog milestone Jan 10, 2023
@ghost
Copy link

ghost commented Jan 10, 2023

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@davidortinau davidortinau added the partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with label Mar 2, 2023
@samhouts samhouts added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Mar 3, 2023
@hartez
Copy link
Contributor

hartez commented Mar 11, 2023

If you want the children of the VerticalStackLayout to be cut off at the height of the VSL, you need to set IsClippedToBounds to True:

<VerticalStackLayout HeightRequest="100" Grid.Row="1" IsClippedToBounds="True">

Note that the ScrollView will still be the height of its content (250) because the VerticalStackLayout doesn't impose any measurement height on it, so while it's visually clipped it still has laid out to a height of 250 with a viewport height of 250; the content won't scroll. The Grid in the first row does impose a height on its ScrollView, so the top ScrollView will scroll its content.

@hartez hartez closed this as completed Mar 11, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Apr 10, 2023
@Eilon Eilon removed the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label May 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-scrollview ScrollView layout-stack p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with platform/android 🤖 platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst platform/windows 🪟 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants