Search code examples
mauimaui-windows

ScrollView does't work on ItemTemplte in collectionView on android


I have define ItemTemplate in CollectionView - with many Label in the itemTemplate.
I expect to be able to scroll and see all the label and this what happaned
on windows when i run it

but on android its not happaned - i can't see the scroll and i don't
find the reson for this

Code:

 <CollectionView                  
 ItemsSource="{Binding MyList}"
 VerticalOptions="FillAndExpand">

 <CollectionView.ItemTemplate>

     <DataTemplate x:DataType="models:MyModels">

         <Border StrokeShape="RoundRectangle 24" HeightRequest="300" StrokeThickness="1" BackgroundColor="White" >

             <Grid Margin="0,5,0,5"  RowDefinitions="6*,2*,Auto" >

                <ScrollView>
                     
                     <VerticalStackLayout Padding="5" Spacing="5" >
                     
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        <Lable Text="text1" />
                        
                     </VerticalStackLayout>
                 
                </ScrollView>
             </Grid>

         </Border>

     </DataTemplate>

 </CollectionView.ItemTemplate>

Solution

  • from the docs

    Warning

    ScrollView objects should not be nested. In addition, ScrollView objects should not be nested with other controls that provide scrolling, such as CollectionView, ListView, and WebView.