ListView Cell Types
Cells in RadListView are the presentation of each data item from the control's ItemsSource. You can choose between two types of cells, namely:
- ListViewTextCell derives from Xamarin.Forms.TextCell and displays text. It can optionally render detail text as a second row within a list view item. This is the default cell of the RadListView.
- ListViewTemplateCell derives from Xamarin.Forms.ViewCell and used to present complex data sets as RadListView.ItemTemplate.
ListViewTextCell Example
This example demonstrates how to create a list view with text cells, like this:
1. Create a view model that will be the source of the list view:
2. Add the definition of the listview control:
3. Add the following namespaces:
4. Finally, set the list view as the content of your page.
ListViewTemplateCell Example
This example demonstrates how to create a list view with templated cells, like this:
1. Create a view model that will be the source of the list view:
2. Define the listview control either in Xaml or in code behind.
You can define the list view in Xaml like this:
- Define the namespace
You can define the list view in code behind:
For clarity, let's build the template of the list view cell in a separate method:
- Define the list view:
3. Finally, set the list view as the content of your page.