| Visual Basic (Declaration) | |
|---|---|
Public NotInheritable Class DataGridCollectionViewSource Inherits CollectionViewSource Implements ISupportInitialize, IWeakEventListener | |
| C# | |
|---|---|
public sealed class DataGridCollectionViewSource : CollectionViewSource, ISupportInitialize, IWeakEventListener | |
For more examples on how to provide data, refer to the Providing Data section in the documentation.
The DataGridCollectionViewSource class is not a view but rather the XAML representation of the DataGridCollectionView class, which has a View property to retrieve the underlying DataGridCollectionView, and a Source property by which the underlying data source can be retrieved.
Like the standard CollectionViewSource, the DataGridCollectionViewSource allows data items to be grouped using either the default PropertyGroupDescription or the DataGridGroupDescription (recommended) and adding them to the GroupDescriptions property. Data items can also be sorted by adding the standard SortDescription structures to the SortDescriptions property, or filtered using the Filter event.
The ItemProperties collection contains a list of DataGridItemProperty objects that can be added or removed and that contain information relative to their corresponding item (you could consider these items to be the columns that will end up in a grid).
In addition to the native CollectionView filtering, the DataGridCollectionView and DataGridCollectionViewSource classes also support automatic filtering, which provides Excel-like end-user filtering according to the distinct values of each column. Automatic filtering can be enabled by setting the AutoFilterMode property to And or Or (by default, None), indicating whether data items will be filtered according to all or at least one of the filtering criteria defined by each column respectively.
By default, the ItemProperties collection is empty to indicate that all the items will be used to create a grid's columns. In this situation, to access the item properties, the ItemProperties collection of the underlying DataGridCollectionView, which can be accessed through the View property, must be used.
If an item is added to the ItemProperties, then both the ItemProperties collections of the DataGridCollectionViewSource and DataGridCollectionView will contain the items.
System.Object
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Data.CollectionViewSource
Xceed.Wpf.DataGrid.DataGridCollectionViewSource
Supported Operating Systems: Windows Server 2003 Service Pack 1; Windows Vista; Windows XP Service Pack 2