Binding to ICollectionView
- 2 minutes to read
Starting with v2011 vol 2, DXGrid supports ICollectionView binding. In previous versions, you had to manually create helper classes to synchronize the grid and collection view. This is no longer required. Assign the source collection to the grid's DataControlBase.ItemsSource property and enable the DataViewBase.IsSynchronizedWithCurrentItem option. The grid automatically synchronizes its grouping, sorting, current item, and can directly change the underlying collection.
#Limitations
Data Binding
- WPF always binds to a view rather than a collection. If you bind a standard control directly to a collection, WPF actually binds to the default view for that collection. DXGrid does not. To support this behavior, a CollectionView should be explicitly specified as a data source for DXGrid.
Filtering
- Values displayed within unbound columns cannot be filtered.
- Two-way filtering is not supported. The filter expression specified within a grid control is automatically applied to a source collection. The filter expression specified within the source collection is not automatically transmitted to the grid control.
- If an ICollectionView implements filtering, DXGrid cannot filter data by using its own internal algorithms.
Sorting and Grouping
- If a sorting rule is not specified for a grouping field in a source collection, DXGrid automatically applies sorting to this field, because group rows are always sorted.
- Manual sorting and/or grouping implemented within the GridControl.CustomColumnSort and GridControl.CustomColumnGroup event handlers, are not supported.
- If an ICollectionView implements sorting, DXGrid cannot sort data by using its own internal algorithms.
- Unbound columns cannot be sorted or grouped.