wpf-403373-controls-and-libraries-data-grid-compare-grids.md
This article describes the main differences between Standard WPF DataGrid and DevExpress WPF GridControl. Use it to migrate from the Standard WPF DataGrid to the DevExpress WPF GridControl.
Standard WPF DataGrid Displays data in tabular format. To configure data presentation, customize the control and column objects. DevExpress WPF GridControl
Uses three types of views to display data. To configure data presentation, customize the View and column objects:
Standard WPF DataGrid and DevExpress WPF GridControl use the same property to bind to data - ItemsSource.
Standard WPF DataGrid Columns use the Binding or SelectedItemBinding property to bind to data. A DataGridTemplateColumn defines data binding inside a cell template. DevExpress WPF GridControl
Columns use the FieldName and Binding properties to bind to data.
The Binding property uses the standard binding mechanism. The FieldName uses PropertyDescriptor objects and has better performance than the Binding property. Refer to the following topic for more information on trade-offs between performance and flexibility: Binding Columns to Data Source Fields.
You cannot use the FieldName property to bind a column to a collection property. To display such a property in a GridControl cell, use any of the following techniques:
GridControl uses the FieldName property to identify columns. When you use the Binding property, the FieldName property is set automatically. Refer to the following topic for more information: Binding Columns to Data Source Fields - How the GridControl Identifies Columns.
Standard WPF DataGrid Add a DataGridTemplateColumn to the column collection. To display data in this column, override its CellTemplate property and specify a data field. DevExpress WPF GridControl Specify a ColumnBase.UnboundExpression that calculates values based on the existing data fields. You can also handle the GridControl.CustomUnboundColumnData / TreeListView.CustomUnboundColumnData events to store an unbound column’s values. Refer to the following topic for more information: Unbound Columns.
The Standard WPF DataGrid does not handle data operations on its own. Instead, it delegates them to the bound ICollectionView.
The DevExpress WPF GridControl can perform data operations on its own. To sort, group, and filter data, you do not need to bind it to an ICollectionView descendant. Refer to the following topics for more information:
The Standard WPF DataGrid does not support sort, group, and filter operations at runtime.
The DevExpress WPF GridControl allows users to perform these operations in several ways.
Do one of the following to sort data against a column:
To clear the sort order, do one of the following:
CTRL key and click the column’s header.GridControl supports sorting by several columns simultaneously.
Topic : GridControl - Sort Data.
Do one of the following to group View data:
To ungroup a View, do one of the following:
You can also change the sort order of columns.
Topic : GridControl - Grouping.
Use one of the following options to filter View data:
Drop-down Filter. Users can click a filter icon in a column’s header to show this menu.
Automatic Filter Row. A special row displayed above all other rows.
Filter Editor. Users can use the Filter Editor form to build filter criteria and create complex filter conditions.
You can clear or disable a filter at runtime. Refer to the following topics for more information:
You can implement a custom sort, group, and filter logic:
To implement custom sorting, set the GridColumn.SortMode property to “Custom” and handle the GridControl.CustomColumnSort event.
Learn more : GridControl - Sorting Modes and Custom Sorting.
Set the GridColumn.SortMode property to “Custom” and handle the GridControl.CustomColumnGroup event to implement custom grouping.
Learn more : GridControl - Group Modes and Custom Grouping.
To customize the filter logic, do one of the following:
Handle the GridControl.CustomRowFilter event and implement custom logic here.
Handle the GridControl.SubstituteFilter/TreeListView.SubstituteFilter events. These events allow you to replace a filter with your filter criteria. You can also implement custom criteria operators to replace the default ones. Refer to the following articles for details:
How to: Implement a Custom Criteria Language Function Operator
How to traverse through and modify the CriteriaOperator instances
The GridControl ‘s built-in Search Panel can highlight search results in the View and optionally filter rows.
Topic : GridControl - Search.
Standard WPF DataGrid
Uses the following typed columns to embed editors into cells:
You can also use a DataGridTemplateColumn. This column allows you to override the cell template and specify the required editor.
DevExpress WPF GridControl
Uses GridColumn objects. Each column automatically creates an editor based on the data field type. Refer to the following topic for a complete list of supported data types and corresponding data editors: Smart Columns Generation.
Refer to the following topic for details on how to customize column editors: Assign Editors to Cells.
Standard WPF DataGrid Does not have a built-in API to format text or numeric fields. You need to use the standard WPF binding to display formatted values. DevExpress WPF GridControl
Allows you to specify the formatting API at the following levels:
Learn more : Format Cell Values.
Standard WPF DataGrid Includes styles and templates that allow you to colorize cells and rows. DevExpress WPF GridControl Supports a Conditional Formatting mechanism in addition to row/cell styles and templates.
Standard WPF DataGrid Requires that you enable validation at the column level with the Binding.ValidatesOnExceptions property. DevExpress WPF GridControl Validates input on exceptions automatically.
Standard WPF DataGrid Requires that you enable validation at the column binding level with the Binding.ValidatesOnDataErrors or Binding.ValidatesOnNotifyDataErrors property. DevExpress WPF GridControl Automatically displays errors when the IDataErrorInfo or INotifyDataErrorInfo interface is implemented.
Standard WPF DataGrid Supports Validation Rules out of the box. DevExpress WPF GridControl The GridControl does not work with Validation Rules directly. Handle the ValidateCell event and use Validation Rules to implement validation logic.
The DevExpress WPF GridControl supports the following techniques that are not supported in the Standard WPF DataGrid. You can validate input and specify different error types and icons at the following application levels:
Model - IDXDataErrorInfo
Model - Data Annotation Attributes
View/ViewModel - Event-Based Validation: