![]() |
Prerequisite Knowledge DataGrid Fundamentals: Object Model Overview |
![]() |
Programmatically, when the DataGridCollectionView is bound to a data source, the ItemProperties.Clear method must be called prior to adding DataGridItemProperty objects to the ItemProperties collection to remove items that were automatically added when the DataGridCollectionView was instantiated. |
Unbound data can be "appended" to a data item through the use of unbound item properties, which are represented by the DataGridUnboundItemProperty class. Unlike unbound columns, which can be used to display non-data related information such as a label or controls that allow some sort of action to be carried out, unbound item properties can be used to provide additional data, such as calculated columns (see Example 1 in Unbound Data).
Grouping, Sorting, and Filtering
Detail Relations (Hierarchical Master/Detail) 
If the data source to which a DataGridCollectionView is bound contains hierarchical detail relations, the content of those relations will be displayed as the details of data items in a grid or in another detail. Relations are represented by DataGridDetailDesciptions objects and will automatically be created for:
- every DataRelation in a DataTable (DataRelationDetailDescription)
- data items that implement the IEnumerable interface (EnumerableDetailDescription)
- data items that implement the IListSource interface (ListSourceDetailDescription)
Automatic creation of detail descriptions can be disabled by setting the AutoCreateDetailDescriptions property of the DataGridCollectionViewSource to false (by default, true) or by specifying so when creating an instance of the DataGridCollectionView.
In order for the details of a data item to be displayed (and created), the parent grid or detail's AutoCreateDetailConfigurations property must be set to true (by default, false at the grid level and true for detail configurations).
![]() |
Hierarchical master/detail is only available when a grid is in a table-view layout. |
For more information on master/detail relations, refer to the DataGridDetailDescriptions Class and Detail Configuration topics.
Inserting and Editing Data Items
The DataGridCollectionView and DataGridCollectionViewSource classes expose events (see Table 1 in Inserting Data) that are triggered during key stages of inserting a new item into an underlying data source. These events provide full control over the insertion process and make it possible to insert items into a source that does not implement the IBindingLIist interface
The DataGridCollectionView also exposes the EditItem, CommitEdit, and CancelEdit methods to allow items in the underlying data source to be edited directly.
For more information on inserting and editing data, refer to the Inserting Data and Editing Data topics.
DataGridCollectionViewSource ClassThe DataGridCollectionViewSource class represents the XAML proxy of the DataGridCollectionView class. The DataGridCollectionViewSource class is not a view but rather the XAML representation of the DataGridCollectionView class.
Most properties and events exposed by the DataGridCollectionView class are also exposed by the DataGridCollectionViewSource class.
![]() |
Most of the XAML examples demonstrated throughout this documentation make use of the DataGridCollectionViewSource class to provide data to a grid. |
Data Virtualization
The DataGridVirtualizingCollectionView class and its XAML proxy, the DataGridVirtualizingCollectionViewSource class, provide support for data virtualization. Also known as "virtual mode" or "lazy loading", data virtualization provides smart deferred querying of data, support for asynchronous data fetching, preemptive loading, and query abort notifications to ensure a smooth and seemless experience that leaves applications responsive and prevents needless queries to data servers.
For more information on data virtualization, refer to the Data Virtualization topic.
Back to Row Class | Go to DetailDescription Class


