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

MAUI: VerticalStackLayout hides the chart #1483

Open
mimeie opened this issue Apr 9, 2024 · 2 comments
Open

MAUI: VerticalStackLayout hides the chart #1483

mimeie opened this issue Apr 9, 2024 · 2 comments

Comments

@mimeie
Copy link

mimeie commented Apr 9, 2024

Hi

I have a problem in .NET MAUI (newest version).

This works fine:
<ScrollView> <lvc:CartesianChart x:Name="myChart" /> </ScrollView>

this hides the whole chart:
<VerticalStackLayout> <ScrollView> <lvc:CartesianChart x:Name="myChart" /> </ScrollView> </VerticalStackLayout>

I cannot find any reason why it is like this. The same happens also in ContentViews.

Thanks for helping.

@beto-rodriguez
Copy link
Owner

beto-rodriguez commented Apr 11, 2024

Hi, the chart has no size. Because the chart is inside a VerticalStackLayout, you must define the size of the chart so the stack layout can do its job.

Setting the HeightRequest property will fix your issue.

<lvc:CartesianChart x:Name="myChart" HeightRequest="300" />

@davidortinau
Copy link

@mimeie in addition to what @beto-rodriguez posted, if you put a ScrollView inside a VerticalStackLayout it will probably take up as much space as it can since VerticalStackLayout doesn't constrain its children. This is a different behavior from Xamarin.Forms where layouts did extra calculations based on children.

If you really need a ScrollView inside a VerticalStackLayout then you must give that ScrollView a size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants