I have a collection view with about 25 elements, I want to allow user to "star" these elements in order to display them in a special collection view in another page. There is a dedicated button to star the element.
I have no idea about how to do this. Any help?
I am working with Xamarin.Forms.
Amira BedhiafiPosted Mar 18, 2025, 9:59 PM
Create a data model that includes a property to track whether an item is "starred" or not.
In your XAML, define a
CollectionViewand bind it to a list of items. Include aButtonin theDataTemplateto allow users to "star" an item.Create a
ViewModelto manage the list of items and handle the "star" command.Set the
BindingContextof your page to theViewModel.Create a new page to display the starred items. Use another
CollectionViewand bind it to a filtered list of starred items.Add a method to get starred items in your
ViewModel.Create a new page to display starred items.
Add a button in your main page to navigate to the starred items page.