WPF DataGrid (SfDataGrid) Overview
5 May 2021 / 5 minutes to read
The SfDataGrid (DataGrid) control for WPF is used to display collection of data in rows and columns. The SfDataGrid control includes editing, exporting and data shaping features (sorting, grouping, filtering and etc) that allows the end users to easily manage the data.
Following are the key features of SfDataGrid control
- Data binding – Supports to bind different types of data sources.
- Selection – Support for row and also cell selection.
- Editing – Interactive support to edit with different column types.
- Columns – Support for various column types including unbound columns.
- Sorting – Interactive support to sort the data in SfDataGrid.
- Grouping – Interactive support to group the data in SfDataGrid.
- Summaries – Extensive support to show concise information about the individual data columns or groups of rows.
- Filtering – Interactive support for filtering data as like in Excel.
- Data validation – Support to validate the data on errors.
- Data virtualization – Support for different modes of data virtualization such as paging, incremental loading.
- Master-Detail View – Support to display relational data using hierarchies.
- Printing and Exporting – Support to print and also export the data to Excel, PDF.
- Styling – Extensive support for customizing styles of cells and rows in SfDataGrid.
- Stacked Headers – Extensive support to show multiple headers called stacked headers.
- Unbound rows – Support to display unbound rows.
- Touch support – Complete support for resizing, drag-drop column, sorting, filtering, grouping and etc in touch devices.
Choose between different Grid’s
Syncfusion WPF suite comes up with following different Grid’s namely,
GridControl is designed based on the cell-oriented architecture that does not make any assumptions about the structure of the data and provides support for Excel-like features. This control can be used when the data is populated in on demand using virtualization or its internal storage. It is not possible to bind the data source directly.
GridTreeControl and SfTreeGrid
The GridTreeControl and SfTreeGrid control is a data-oriented control that displays self-relational data in a tree structure user interface like multicolumn treeview. The data can be loaded on demand. You can move items between parent nodes by using the built-in row drag-and-drop functionality. Its rich feature set includes editing with different column types, selection, and node selection with check boxes, sorting, and filtering.
GridDataControl and SfDataGrid
- SfDataGrid - SfDataGrid is designed based on the WPF template-based architecture that provides support to customize the Grid easily and fully supports binding.
- GridDataControl - GridDataControl is designed based on the cell-oriented architecture of the Windows Forms Grid control that provides more control over cells and supports for Excel-like features.
Both SfDataGrid and GridDataControl almost have the same set of features. But SfDataGrid control offers rich set of features over GridDataControl. When you want cell level customization and excel-like features you can use GridDataControl. When you want performance, customization features like styles & template features specific to WPF, you can use SfDataGrid control. Comparatively, the performance of SfDataGrid control is better than the GridDataControl.
GridDataControlis marked as classic control. In future, new features & enhancements will be added only in
SfDataGrid. It recommended to use
You can see the list of some of the specific API difference between
SfDataGrid as follows:
|AutoPopulateColumns||AutoGenerateColumns||To Generate the Columns|
|AllowEdit||AllowEditing||To Edit the GridCells|
|AllowGroup||AllowGrouping||To Group the Column header|
|AllowResizeColumns||AllowResizingColumns||To Resize the columns|
|AllowDragColumns||AllowDraggingColumns||To Drag the columns|
|AllowSort||AllowSorting||To Sort the columns|
|ShowFilters||AllowFiltering||To Show the Filters in a Grid|
|VisibleColumn||Column||To Specify the GridColumns|
|AllowExcelLikeResizing||AllowResizingHiddenColumns||To Allow Resizing on the Hidden Columns|
|ShowHoveringBackground||AllowRowHoverHighlighting||To show the Hovers for Highlighting rows.|
|EnableTriStateSorting||AllowTristateSorting||To allow Tri State Sorting|
|ExpandGroupsWhenGrouped||AutoExpandGroups||To Allow Auto Expand groups|
|AutoPopulateRelations||AutoGenerateRelations||To set an item source for child Grid.|
|SortColumns||SortColumnDescriptions||The column sorting based on the column descriptions that are given in a particular column.|
|ShowSortNumber||ShowSortNumbers||To Show the Sorted Numbers when sorting.|
|HideColumnsWhenGrouped||ShowColumnsWhenGrouped||To Show the Columns when grouped.|
|HighlightSelectionBackground||RowSelectionBrush||To give a color for RowSelection.|
|ListBoxSelectionMode||SelectionMode||To Specify the Selection Mode for a selection.|
|DefaultHeaderRowHight||HeaderRowHeight||Specifies the Header Row and Height.|
|SummaryRows||GroupSummaryRows||To Group the Summary row based on the Summary given in that row.|
|FrozenRows||FrozenRowsCount||The number of rows is freeze from Top.|
|FooterRows||FooterRowsCount||The number of rows is freeze from bottom.|
|FrozenColumns||FrozenColumnCount||The number of columns is freeze from left.|
|FooterColumns||FooterColumnCount||The number of columns is freeze from right.|
You can see the list of rich set of features in
GridDataControl as follows:
Rich set of features in
|AutoRowHeight||SfDataGrid enables fitting the height of the row based on its content on demand for all columns or certain columns by using|
|CellTemplate Support for all columns||SfDataGrid provides support for|
|IEditableObjectSupport||SfDataGrid supports to roll back the changes when you press Esc Key by implementing IEditableObject interface. For more information about IEditableObject refer|
|Printing||The Printing feature in SfDataGrid is more flexible and customizable. It also provides a good performance when compared to GridDataControl.For more information about CustomPrinting, click|
|Exporting To Excel||SfDataGrid control provides support to Export data to Excel and returns an ExcelEngine that contains the exported workbook. SfDataGrid Exporting is faster than GridDataControl. It exports the content only to the excel sheet. It takes very less time to export the huge amounts of data. To know more about exporting in SfDataGrid, click|
|Exporting To PDF||SfDataGrid control provides support for exporting the data into a PDF file. You can decide what are the contents is need to export in PDF file. You can export Grouping, Filtering, Summaries and DetailsView, StackedHeaders in to PDF file.To get more information about|
|FilterPopupPerformance||When you have a large amount of data, it takes time to load the Filter popup. Though, you are having lots of data, you can get better performance while loading Filter popup, by setting CanGenerateUniqueItems to False. To know more about FilterPopupPerformance, click|