Xamarin: Elements are cut off/not rendered in ScrollViewer

Viewed 293

I've following situation.

<ScrollView BackgroundColor="DeepPink">
    ...
    <Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
        <ContentView Opacity="{Binding  ViewProvider.IsCancelling, Converter={StaticResource BoolToOpacityConverter}}" Content="{Binding ViewProvider.CurrentView}"/>
    </Grid>
    ...
</ScrollView>

The Content View contains multiple elements and one of them is a StackLayout with BindableLayout.ItemsSource

<StackLayout BindableLayout.ItemsSource="{Binding Rings}" Margin="12,0,0,0">
    <BindableLayout.ItemTemplate>
        <DataTemplate>
            ...
        </DataTemplate>
    </BindableLayout.ItemTemplate>
</StackLayout>

The Rings will be added by different actions while the View is open. As soon as this happens, the height of the ScrollViewer increases, but the parts below are cut off or just not rendered. (It cut's the height off, which the rings are using - I guess because the Grid doesn't resize? But why?)

ScrollViewer Issue with Xamarin

I've tried to call InvalidateMeasure() and ForceLayout() after adding rings but without any changes. Any ideas?

Edit

As requested in the comments I've uploaded a simple demo on github to reproduce this issue. https://github.com/Valronicon/ScrollViewerIssue

Thank you!

Edit 2

I was able to fix this by wrapping the ScrollViewer within an additional Grid. Don't know why it works, but it works...

1 Answers

As Rich Mentioned wrapping the scrollview in a grid seemed to solve this issue for me as well, so im posting it as an answer

<Grid> 
    <ScrollView>
    ...
    </ScrollView>
</Grid>
Related