Know the answer? Post it. Somebody with the same question will find it here.
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Oct 27, 2020, 12:16 AM EDT
+1
explain in details what your looking for
+1
Nimish SaxenaRank #2,279 · 618 reputationPosted Oct 27, 2020, 12:23 AM EDT
+1
Scrolling video like tiktok.but need to scroll is infinite in Carousel view
+1
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Oct 27, 2020, 12:55 AM EDT
+1
After the project creation, install “Xamarin.Forms.Extended.Infinitescrolling” NuGet package. For that, go to Solution Explorer and right-click Solution and select Manage NuGet Package option, In the window, move to browse tab and search “Xamarin.Forms.Extended.InfiniteScrolling” and install it.
For example:
C# Code: Add a new model class named “Item.cs”. For that, create a Model folder in the shared project, under the Models folder, add Item.cs class and write the below-given code.
publicclass Items
{
publicstring Id { get; set; }
publicstring Text { get; set; }
publicstring Title { get; set; }
publicstring Description { get; set; }
}
Next, create a dummy data class named “DataItems.cs” and paste the below-given code.
Now, add the new Tabbed Page. For that, open Solution Explorer => right-click the shared project => select Add => in the dialog window, left plane selects Xamarin. Forms and center plane select Tabbed Page and give the name as “MainPage” and click Add. As well as, add two new content page, names are “SingleViewList” and “GroupViewList”. Open the SingleViewList.xaml page and write the below-given code. In the code, we designed simple ListView and setting up the list view behavior as infinite scroll and ListView Footer design.
Code Behind of SingleViewList.cs. We are just binding the data and setting the page size.
C# Code:
privateconstint PageSize = 20;
public SingleViewList()
{
InitializeComponent();
Items = new InfiniteScrollCollection
{
OnLoadMore = async () =>
{
// load the next page
var page = Items.Count / PageSize;
var items = await DataItems.GetItemsAsync(page, PageSize);
IsWorking = false;
return items;
}
};
// load the initial data
loadDataAsync();
}
public InfiniteScrollCollection Items { get; set; }
publicbool IsWorking
{
get; set;
}
private async Task loadDataAsync()
{
var items = await DataItems.GetItemsAsync(pageIndex: 0, pageSize: PageSize);
Items.AddRange(items);
ListsingleItems.ItemsSource = Items;
}
Next, open GroupListView.xaml and paste the below-given code. The same thing as SingleViewList.cs page, but we are using Grouping based ListView of Header and Item template ListView.
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Oct 27, 2020, 12:16 AM EDT
Nimish SaxenaRank #2,279 · 618 reputationPosted Oct 27, 2020, 12:23 AM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Oct 27, 2020, 12:55 AM EDT
Nimish SaxenaRank #2,279 · 618 reputationPosted Oct 27, 2020, 1:15 AM EDT
Mageshwaran RRank #411 · 6.1K reputationPosted Oct 27, 2020, 6:28 AM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts