Home > Software design >  Xamarin two collectionviews right after one another without space between them
Xamarin two collectionviews right after one another without space between them

Time:09-01

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

CodePudding user response:

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>
  • Related