Forum Xamarin.Forms

Two listviews on one page

ganesh96ganesh96 Member ✭✭✭

Hi All,

I've seen several topics on this, but none of them worked for me (or I cannot make it work for me): how to add two listviews with separate data on one page?

In my case, I want two listviews under each other. I have one listview already inside a grid. The code for this listview is:

How can I add a second listview under this current listview?

Tagged:

Best Answers

Answers

  • aliahmad71452aliahmad71452 Member ✭✭

    You want ListView inside a ListView.?

  • ganesh96ganesh96 Member ✭✭✭

    No, ListView1 should be positioned at the top of the screen, ListView2 should be below ListView1.

  • aliahmad71452aliahmad71452 Member ✭✭

    You want to display ListView1 on half page and ListView2 on the other half?

  • ganesh96ganesh96 Member ✭✭✭
    edited June 2020

    The length of ListView1 (a.k.a. the number of items) can differ, meaning that the location of ListView2 is determined by the length of ListView1. Hence why ListView2 needs to stay under ListView1.

  • aliahmad71452aliahmad71452 Member ✭✭

    You can use BindableLayout for that. if you want scrolling you can wrap it by ScrollView.

  • ganesh96ganesh96 Member ✭✭✭

    Do you have a small example?

  • aliahmad71452aliahmad71452 Member ✭✭

    If you want to set it by x:Name you can do like this.

    BindableLayout.SetItemsSource(firstList, new List<string>());

Sign In or Register to comment.