The Excel-like WinForms Grid control is a cell-oriented control for displaying tabular data and can be customized down to the cell level. It does not make any assumptions regarding the structure of the data.It can be used in a virtual manner, where the data is provided on demand in real time, or it can be used in a manner where the cell grid maintains the data within its own internal structures.Its rich feature set includes editing, cell styling, data formatting, covered cells, various cell editors, clipboard operations, formulas, Excel-like selection, frozen rows and columns, importing and more.
There are two modes for populating the grid control with data (cell values and the required cell styles). You can use its internal data storage or provide the data on demand through virtual mode. To use the grid control’s internal data storage, you can simply set the cell styles using the grid indexer. To configure the grid control in virtual mode, you need to dynamically provide data to the grid through an event. This means that the grid does not store any data in its internal data structures. A virtual grid can display millions of rows as easily as it displays a dozen. The grid also exposes a second event that lets you save changes made through the grid’s UI back to the external data source.
Grid is a cell-oriented control that allows you to apply styles at the cell level. Individual cells can be customized in different formats. Every cell in a grid is associated with a list of attributes that affect the appearance of the grid cells.
The grid control supports several cell types, including text box, combo box, combo box autocomplete, check box, button, numeric spin box, drop-down list, drop-down calculator, password, link label, color picker, chart, progress bar, rich text, picture box, slider, UI editor, web browser, XHTML, radio button, embedded grid cells, and editor types like masked edit, double edit, integer edit, percent edit, button edit, and date-time edit. In addition, you can place any Windows Forms control or any custom control inside a cell using the control cell type. Cell types are implemented using a highly efficient, flyweight pattern-based architecture. Thousands of cells can share the same control instance, providing tremendous savings in resources. This enables grid to handle billions of rows with ease. The grid control provides a pluggable cell renderer architecture for easily implementing custom cell types without compromising on performance.
Grid supports alpha blending and background bitmaps. The alpha value can be applied to individual cells or base styles by changing the interior cell attribute.
Banner cells allow users to combine the background of neighboring cells to display a background image or gradient brush. Users can load an image from a file on disk and display it in a cell, as a gradient among cells, or create custom cell backgrounds.
Multiple cells can be covered to exhibit the behavior of a single cell. This makes it easy to display special items such as titles and bitmaps such that they occupy multiple cells. Covered cells blend seamlessly with grid’s keyboard navigation model. Covered cells can also host any grid control type. They can be interactively created and cleared by end users. Formatted covered cells with their own borders are illustrated below:
Merged cells allow users to display adjoining cells with similar values as a single cell. The merging is dynamic. If a cell’s value changes, the grid will automatically adjust the merged cells.
Grid exposes an Excel-like format cells dialog that aids in dynamic cell formatting. It now comes with options such as font, number, background, and alignment. With this feature available, you can format numerous grid cells with ease.
Frozen columns and rows stay stationary much like the default headers when scrolling through the body of a grid. They are very useful when an application requires header rows or columns in addition to default headers. Frozen columns are moved to the far left of the grid and remain there when the grid is scrolled. Frozen rows are moved to the top of the grid and remain there when the grid is scrolled. Frozen rows and columns are typically used in reporting applications where there is a need for extensive header information. A unique aspect of grid’s frozen rows and columns is that they can be configured to any cell type. They do not have to look like the header row.
All grid drawing code is implemented using GDI+. GDI+ is the C++ based version of its predecessor GDI (Graphics Device Interface). GDI+ is an improved 2-D graphics environment with advanced features such as anti-aliased 2-D graphics, floating point coordinates, gradient shading, more complex path management, and intrinsic support for modern graphics-file formats like .jpeg and .png.This enables grid cells to display gradients, rotate text, and support transparency.
Grid offers different kinds of selection modes, such as row only, column only, cell only, and more.
Grid can simulate a list box control. All three list box modes are supported: one, multi-simple, and multi-extended. The list box can be bound to any collection or ADO.NET table.
Grid provides extensive support for keyboard handling. Enter key saves the current cell and moves on, arrow keys move the current cell, Page Up/Page Down keys scroll through grid pages, F2 activates/deactivates a cell, F4 + ALT drops-down/closes-up a cell, Ctrl+arrow keys move to first/last row/column, Shift + arrow keys select cells, Ctrl + X, Ctrl + V, Ctrl + C, Insert key, and Delete keys support common clipboard operations. All keyboard operations can be customized.
Grid extends its support to Multiple Document Interface (MDI) by allowing users to work with multiple grid controls at the same time.
Grid’s mouse and hit-testing operations are implemented using a special MouseController pattern. This allows easy implementation of custom mouse operations pertaining to different hit test contexts. This architecture fully supports the Windows Forms Framework with events such as MouseHover, MouseLeave, and MouseEnter.
The grid control offers very flexible scrolling support. It supports accelerated scrolling similar to Microsoft Office applications. Holding down the scroll button generates accelerated scrolling. Users can also select cells and move them to the edge of the control’s scrollable area to scroll through the grid. A grid can be hooked to an external scroll bar or can have common scroll bars for two or more grid controls. It also supports IntelliMouse scrolling and has the option to display scroll tips when dragging the scroll box. The grid control also supports the automatic scrolling of cells when users click and drag the mouse wheel, similar to Microsoft Excel.
Grid provides complete clipboard support. Users can copy and paste inside a grid and from or to other OLE (Object Linking and Embedding) DND (Drag-and-Drop)-enabled applications that understand text format. OLE DND between two grids includes a custom format that allows users to copy or move complete style information including covered cells. Grid also provides hooks for the easy addition of support for custom data formats. Copy and paste and drag-and-drop operations retain all formatting when performed between grid controls. OLE objects (Excel or Word files for example) can be embedded within cells, represented by an icon, and clicking on the icon will open the embedded content in the appropriate application.
The undo and redo commands add immeasurable value to the user interface of any application. The grid control offers complete support for multilevel undo and redo operations. Any changes to the grid are saved in an undo list to perform subsequent undo and redo operations when needed. A group of such actions, called a ‘transaction,’ can be rolled back in a single step.
The grid control supports Microsoft Excel-like formulas in each cell. It comes with an extensive formula function library supporting more than 150 built-in formulas. You can also easily add custom functions to its function library. The grid control also supports cross-sheet references and named ranges.
The grid control supports Excel-like user interactive features like cell range drag-and-drop, selection autofill, visual indicators to show hidden rows and columns, and “#” (or customizable) place holders when the full text cannot be shown in the available cell width. It also provides Excel-like current cell for editing.
Grid provides support for Excel-like comments that can be used to display additional notes. The appearance of comment indicators and tips can be customized for each cell.
Grid offers an Excel-like pivot table feature. Using this feature, users can pivot data via drag-and-drop operations to organize the data in a cross-tabulated form. This allows users to present desired information from a large data list within seconds.
A Microsoft Access-like record navigation bar lets users scroll through records in a table. The total number of records can also be displayed in the navigation bar next to the current record number.
MFC applications are usually designed using the document-view pattern. This pattern is a variant of the Model View Controller (MVC) pattern. In practice, this refers to the complete separation of data and presentation, enabling the creation of extremely flexible and adaptable components. Grid provides complete separation of its data and display details. This allows users to easily implement multiple views of the same data, similar to MFC document-view applications.
The grid control view can be split into different sections using the splitter control in Essential Studio.
Grid can be used inside a dynamic splitter control. The control inside the split view will normally share the same data model, providing a sophisticated perspective of the same data, similar to Microsoft Excel. Dynamic splitting is a feature that adds extra usability to any user interface. Components must have built-in support to provide split views.
Grid contents can be zoomed in and out as required. Some available zoom options include percentage zooming at grid level and zooming at cell level.
The appearance of the grid control can be enhanced by applying one of the several Microsoft Office 2003, Microsoft Office 2007, Microsoft Office 2010, Windows Vista, and Metro styles available.
Grid supports versioned serialization of grid data to binary, .xml, and SOAP (Simple Object Access Protocol) formats. Future versions of Syncfusion’s grid will automatically read legacy files from earlier versions. Versioning is a must for applications that are expected to have a long market life span. However, many third party .NET controls on the market do not implement versioning because the default serialization provided in Windows Forms does not support versioning.
Grid control contents can be exported to Microsoft Excel, and Microsoft Excel file contents can also be imported to the grid control.
Grid control contents can be exported to a PDF file. It also supports drawing custom headers and footers.
Grid provides complete support for print and print preview operations. There is a special mode to display a grid in grayscale. This is especially useful when printing a grid using black ink. The grayscale print will exhibit finer contrast between cells compared to prints in default mode. Print preview lets you clearly visualize the contents of the different pages before you print. Print to fit support allows you to shrink the grid to print on one page or a specified number of pages. There is also support for specifying column breaks while printing.
Grid provides Coded UI support in which the inner elements of the control are automatically detected through testing. The data grid and data bound grid also support the Coded UI technology. There are three levels of support in Coded UI test automation.