New to Telerik UI for WPF? Download free 30-day trial

Data Field Descriptor

CardDataFieldDescriptor is the element describing the data fields of cards in the RadCardView control.

The descriptors are used to setup the property binding of the data field and to provide several more settings.

Auto Generating Descriptors

By default the control will try to auto generate descriptors based on the public properties of the objects in the ItemsSource. This means that setting the ItemsSource of RadCardView is enough to use the control and display/edit data fields.

To interfere in the automatic generation of the CardDataFieldDescriptor objects, use the AutoGeneratingDataFieldDescriptor event. The event handler can be used to cancel the generation of a descriptor, replacing it or customizing its properties.

Example 1: Canceling the generation of a descriptor for a property named "LastName"

private void cardView_AutoGeneratingDataFieldDescriptor(object sender, CardViewAutoGeneratingDataFieldDescriptorEventArgs e) 
{ 
    if (e.DataFieldDescriptor.Header.Equals("LastName")) 
    { 
        e.Cancel = true; 
    } 
} 

Manual Descriptor Definitions

To control the number of data fields and the properties that should be available in the card, you can disable the automatic generation of descriptors and add them manually. To do this, set the AutoGenerateDataFieldDescriptors property of RadCardView to False and use the DataFieldDescriptors collection.

Example 2: Defining CardDataFieldDescriptors

<telerik:RadCardView AutoGenerateDataFieldDescriptors="False"> 
    <telerik:RadCardView.DataFieldDescriptors> 
        <telerik:CardDataFieldDescriptor Header="Name" DataMemberBinding="{Binding Name}" /> 
        <telerik:CardDataFieldDescriptor Header="Number" DataMemberBinding="{Binding Number}" /> 
        <telerik:CardDataFieldDescriptor Header="Category" DataMemberBinding="{Binding Category}" /> 
    </telerik:RadCardView.DataFieldDescriptors> 
</telerik:RadCardView> 
The DataMemberBinding binding should point to a property of the items in the ItemsSource.

See a runnable code snippet in the Data Binding article.

Disable Data Field Editing

By default each data field generated by the descriptors can be edited. To disable this, set the IsReadOnly property of CardDataFieldDescriptor.

Example 3: Setting CardDataFieldDescriptor IsReadOnly property

<telerik:RadCardView.DataFieldDescriptors> 
    <telerik:CardDataFieldDescriptor DataMemberBinding="{Binding Name}" IsReadOnly="True" /> 
</telerik:RadCardView.DataFieldDescriptors> 

Data Field Visibility

The visibility of the data fields in the RadCardView's cards can be toggled via the IsVisible property of CardDataFieldDescriptor.

Example 4: Setting CardDataFieldDescriptor IsVisible property

<telerik:RadCardView.DataFieldDescriptors> 
    <telerik:CardDataFieldDescriptor DataMemberBinding="{Binding Number}" IsVisible="False" /> 
</telerik:RadCardView.DataFieldDescriptors> 

Display Order

The display order of the data fields in a card is determined by the order of the properties in the underlying class, in case you use the data field descriptor's auto generation feature. When the descriptors are added manually in the DataFieldDescriptors, then the display order is the same as the order of the items in the collection. Additionally, the display order can be controlled via the DisplayOrder property of the CardDataFieldDescriptor element.

Example 5: Setting CardDataFieldDescriptor DisplayOrder property

<telerik:RadCardView.DataFieldDescriptors> 
    <telerik:CardDataFieldDescriptor DataMemberBinding="{Binding Name}" DisplayOrder="1"/> 
    <telerik:CardDataFieldDescriptor DataMemberBinding="{Binding Number}" /> 
</telerik:RadCardView.DataFieldDescriptors> 

Filtering, Sorting and Grouping

The UI of RadCardView allows you to filter, sort and group the data in the ItemsSource. The descriptor element allows you to customize the corresponding settings.

Read more about the filtering feature in the Filtering article.

Read more about the filtering feature in the Sorting article.

Read more about the filtering feature in the Grouping article.

By default the property bound to the DataMemberBinding is used for the filtering. To change this, set the FilterMemberPath property which should point to the new property that will be used for the filtering.

The filtering from the UI can be disabled via the AllowFiltering property.

Customizing Data Fields UI

The UI of the data field's value presenter can be customized using the EditorTemplate property when the data field is in edit mode. To change the element when the data fields is in normal state, then set the ReadOnlyTemplate. Read more in the Customizing Cards article.

See Also

In this article