Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
144052 | Apr 16,2019 09:00 AM UTC | Apr 25,2019 04:33 AM UTC | Xamarin.Forms | 7 |
![]() |
Tags: SfListView |
public PagesViewModel(double height)
{
ScreenHeight = height;
int j = 0;
int itemsPerPage = (int)(height / 80) * 4;
int temp = itemsPerPage;
CarouselPages = new ObservableCollection<List<Contacts>>();
var contactsviewmodel = new ContactsViewModel();
var count = GetPageCount(height, contactsviewmodel.ContactsInfo.Count, itemsPerPage);
for (int i = 0; i < count; i++)
{
var source = contactsviewmodel.ContactsInfo.Skip(j).Take(temp);
var items = source.AsEnumerable().ToList().ToList();
CarouselPages.Add(items);
j += itemsPerPage;
}
}
private int GetPageCount(double height, int count, int itemsperpage)
{
int i = 0;
int itemscount = 0;
while (itemscount <= count)
{
itemscount += itemsperpage;
i++;
}
return i;
}
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.