We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Is it possible to have more than 1 sf list view in a content page?

In the sample code examplesContentPage.BindingContext is always used and is pointed to a single ViewModel. I would like to have 2 totally separate sf list views on the same content page that look to totally different view models. In xamarin you can populate itemssource in the code behind. Is this possible using sync fusion? 2 lists would allow me to clearly separate the two in the UI. The 2 lists also will have items added and removed.
Any suggestions or code samples would be greatly appreciated...

5 Replies

DB Dinesh Babu Yadav Syncfusion Team February 15, 2017 06:57 PM UTC

Hi Darrell, 
Thank you for using Syncfusion products. 
We have prepared a sample based on your requirement “Two SfListView in a ContentPage”, which illustrates to define the multiple SfListView in a content page with different view models. And also you can add and remove the items in each SfListView. You can download the sample from the below link. 
Please let us know if you require further assistance. 
Dinesh Babu Yadav 

DB darrell breyer February 16, 2017 01:57 PM UTC

Thank you for your response.  I will give it a try and let you know if I have any questions....

DB Dinesh Babu Yadav Syncfusion Team February 17, 2017 09:57 AM UTC

Hi Darrell, 
Thanks for the update. 
Dinesh Babu Yadav 

DB darrell breyer February 21, 2017 04:18 PM UTC

Hi Dinesh,

Thanks you for providing the answer via sample code.  It's very helpful.  I implemented the code and am able to see the 2 views nicely.  However I noticed the content of the view is contained in a fixed height, and to see all the list data  I have to scroll.  Is it possible to show the full list?  Each list will only be a few items.  I need the list area to grow in size as items are added to the list without adding a scrollbar.  

Sorry if this is confusing...


DB Dinesh Babu Yadav Syncfusion Team February 22, 2017 04:05 PM UTC

Hi Darrell, 
SfListView doesn’t provide support for your requirement due to restrictions in Xamarin Forms layout. By default, in Xamarin Forms any view will be arranged with maximum value of allocated size and available size.  
Allocated size – size allocated by the parent to render its child. 
Available size – size calculated by the child to render itself. 
However, you can achieve your requirement in the sample level by modifying the HeightRequest value of the SfListView based on your items’ height. This is just a workaround and is not guaranteed to work on complex layouts in Xamarin.  
We have prepared a sample to meet your requirement and you can download the same from the below location. 
Regarding your query, “I need the list area to grow in size as items are added to the list without adding a scrollbar”. 
When the underlying data in SfListView exceeds the view area, the scrollbar will be automatically enabled to represent that the list view items are scrollable. This is the actual behavior of a ListView and cannot be changed.  
Dinesh Babu Yadav 

Live Chat Icon For mobile
Up arrow icon