Data Binding
RadCardView is populated with cards via its ItemsSource property.
This article shows how to prepare and set the ItemsSource, and data bind the cards' properties to the underlying data items.
For each public property in the underlying objects of the ItemsSource a data field is auto-generated in the card.
The control internally works with a QueryableCollectionView which handles the sorting, grouping and filtering operations. This said, if an IEnumerable is set as ItemsSource it will get wrapped into a QueryableCollectionView object.
Example 1: Defining the model
Example 2: Setting the data context
Example 3: Setting up the view
Figure 1: RadCardView example
The data fields in the cards are automatically generated based on the public properties of the CardInfo
class from Example 1. To change this behavior you can set the AutoGenerateDataFieldDescriptors property of RadCardView to False and then define the descriptors manually in the DataFieldDescriptors collection of the control.
Manual Data Field Generation
To disable the automatic data field descriptor generation, set the AutoGenerateDataFieldDescriptors property to False. Then add CardDataFieldDescriptor elements in the DataFieldDescriptors collection of RadCardView.
Example 4: Defining CardDataFieldDescriptors
Figure 2: RadCardView example
Read more about the data field descriptor's settings in the Data Field Descriptor article.
Binding to CollectionView
In order to easily control the sorting, filtering and grouping, you can use QueryableCollectionView
or QueryableCollectionViewSource
.
Example 5: Setting up QueryableCollectionViewSource
Figure 3: RadCardView grouping example
Read more about the collection view descriptors in the QueryableCollectionView or QueryableCollectionViewSource article.