Embedding Editors into Container Controls
All data editors in the XtraEditors Library support a common internal design - Settings needed to manage a standalone control - size, position, tab index, etc are supplied by the editor class itself, while remaining settings are exposed using a separate object which is available via the editor's Properties.
This structure offers you an incredibly easy way to manage editors when used both standalone and for cell-based editing. Controls like the XtraGrid are thus able to manage the editor's size, location, hints, etc, and the settings you must apply are always the same whether placing a standalone editor on a form or using it within a grid cell.
There are countless usability features that ship with the XtraEditors, but perhaps the one that guarantees the highest possible design time productivity for you lies in the library's ability to easily reuse editors across an entire application. This is possible because editor-specific settings are managed via separate classes known as repository items. Container controls can create fully functional editors and accept all necessary editor settings from these classes. This, in turn, allows you to reuse the same editor settings across all grids, toolbars, and treelists used in your application.
Assume you need to use a dropdown calendar for multiple columns within a grid, for a toolbar item, and for rows in a vertical grid control. In such instances, you need only create a single instance of the DateEdit repository item and bind it to all columns, rows, and toolbar items - Yes, it's that easy. To make this possible, the XtraEditors Library provides the following features:
Via the PersistentRepository component, you can store individual repository items allowing them to be reused in multiple controls.
All controls that accept embedded editors are derived from the EditorContainer class. All components that allow editor integration (for instance the BarManager component from the XtraBars Suite) are derived from the same ComponentEditorContainer class. These classes maintain internal editor repositories and allow you to bind an external repository to them.
All controls offer a convenient design-time repository item selector. You can assign existing items, create new items and change their settings directly within the Properties window.
The ability to reuse editor functionality is not only a great way to dramatically decrease development time, but also a great way to increase the reliability of your applications as reusing the same editors in multiple places increases the chance that you will catch any bugs in your validation logic early, and by virtue of the fact that the problem has to be fixed in only one place, decrease the time necessary to fix app logic issues.
Here are a few additional benefits available to you when using the XtraEditors Library for cell-based editing:
- Each editor has two helper classes that are responsible for the editor's internal layout and painting. When the same editor is used in multiple locations, the container control uses these helper classes to paint its cells. The actual editors are only created when users start to edit a cell and are destroyed when editing is completed - thus providing a huge performance boost.
If your application must display image or memo data, you usually have two design options: The first is to fully display the images and text within the container control, which may result in large data rows or even variable row height. The second is to use data rows with a fixed height, which would obviously lead to data truncation. The XtraEditors Library provides a third alternative - using our specially designed MemoExEdit and ImageEdit controls, you can display images and memo data within cells which would be edited within dropdown windows. This allows you to provide memo and image editing while preserving the container's layout.
For optimum usability, data editors that allow value scrolling via the keyboard, also include CTRL+UP and CTRL+DOWN key combination shortcuts. These shortcuts can be used to scroll the editor's value within container controls like the XtraGrid because UP and DOWN keys are intercepted by the container to move row focus.
Creating Custom Editors
We know that no component library is an island and that you might need a specialized control that we do not ship. It is for this reason that we ship 3 custom data editor samples within the library to illustrate how straightforward and easy it is to descend from our controls and create custom components that specifically address your business needs. Of course, all custom editors you create can take full advantage of our entire framework and will behave in the same exact manner as those we've engineered.
The image below illustrates the inheritance hierarchy for our embeddable editors. Note the nesting - nearly every control takes full advantage of multiple ancestors. For instance, masks can be used in almost all editors since textbox-based editors are derived from the TextEdit control. The ButtonEdit class also sits near the root of the hierarchy. This means you can use editor buttons in nearly all editors we offer. This hierarchy is obviously available to you when creating your own custom editors - simply select the appropriate ancestor and the rest is as easy as writing a few lines of code.
It's Your Choice: All DevExpress WinForms Controls can be purchased as part of the following Subscriptions:
What's New in 2012
The best keeps on getting better. Our newest WinForms controls and features include:
WinForms Tech Library
Explore the power of the DevExpress WinForms product line at your pace with the following online technical resources: