[FIXED] Xamarin two collectionviews right after one another without space between them

Issue

I am trying to display two collection views in a page. I want first collection view displays all of its items and only after the second collection view starts right after end of the first collection view without any space to display its items. The lists are dynamic, each time they may have different number of items.

However when I add the second collection view in the page, the page divided into to two section. How can I achieve what I want. Any help appreciated

the image shows what is needed

Solution

Thanks to @ToolmakerSteve this solution is acceptable for me.

 <ContentPage.Content>
    <StackLayout>
        <Label Text="Welcome to Xamarin.Forms!"
            VerticalOptions="Start" 
            HorizontalOptions="CenterAndExpand" />

        <Label Text="List 1" TextColor="Chocolate"  FontSize="20" Padding="10" />
        <StackLayout BindableLayout.ItemsSource="{Binding ItemList1}" >
            <BindableLayout.ItemTemplate>
                <DataTemplate >
                    <StackLayout>
                        <Label Text="{Binding Text}"/>
                    </StackLayout>
                </DataTemplate>
            </BindableLayout.ItemTemplate>
        </StackLayout>

        <Label Text="List 2" TextColor="Chocolate"  FontSize="20" Padding="10" />
        <StackLayout BindableLayout.ItemsSource="{Binding ItemList2}" >
            <BindableLayout.ItemTemplate>
                <DataTemplate >
                    <StackLayout>
                        <Label Text="{Binding Text}"/>
                    </StackLayout>
                </DataTemplate>
            </BindableLayout.ItemTemplate>
        </StackLayout>         

    </StackLayout>
</ContentPage.Content>

Answered By – Maria21

Answer Checked By – Marilyn (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published