Skip to main content
All docs
V19.1

Editor Class Structure

  • 3 minutes to read

This topic discusses how editors are organized internally. It describes the classes used and explains how editors can be used for in-place editing in container controls.

Editor Class Structure

The DevExpress editors are BaseEdit descendants. These classes represent stand-alone controls that you can place onto a form. These are also the controls that are created by containers when an editor is activated (when editing a cell value, for instance). Note: the BaseEdit class only implements the basic internal class structure, and doesn’t introduce any editor functionality, but merely declares the members supporting the common look and feel, appearance and tooltips support mechanisms and the members required by container controls to work with their in-place editors.

Each editor control has its associated repository item. Repository items are objects that store editor settings and event handlers. You can access such objects via the editors’ BaseEdit.Properties property. Note: when you create an in-place editor, you actually create a repository item object. This is possible because settings provided by repository items are sufficient to create fully functional editors. As stated above, the look and feel, appearance and tooltip mechanisms are implemented in actual editor classes. So, you will have no access to these settings (or need for them) when creating an in-place editor. These settings are controlled by container controls holding the in-place editors and you will only need to customize these settings when using standalone editors.

Two other significant class types are Painter and ViewInfo classes. They are initialized when the repository item is created using the internal CreatePainter and CreateViewInfo methods. A ViewInfo class (e.g. DateEditViewInfo) contains a set of properties necessary for drawing the control. When a control must be drawn (or redrawn), the Painter class (e.g. PainterTextEdit) uses the information supplied by the ViewInfo class to do it.

The image below illustrates an editor’s internal structure. Repository items are capable of creating all the other classes.

Concepts - InternalStructure

As a result of this class structure, you can use the controls stand-alone or as in-place editors for other controls (such as Grid Control). Let’s consider an editor used to edit grid column values. In this instance, the new RepositoryItem descendant is created within the grid’s EditorContainer.RepositoryItems collection. This class initializes the Painter and ViewInfo classes. These classes are used to draw all cells within the column. And, the ingenious aspect is that the Painter and ViewInfo classes are separate from the editor class, allowing you to draw all cells without actually creating the control. The editor class itself is created only when a cell is edited and is removed when editing is finished.

When creating custom editor controls, you need to follow this editor structure, so that container controls can manage your editor properly.

Text Editors

Text editors in the XtraEditors library are represented by the TextEdit class and its descendants. Internally, each DevExpress text editor owns a text box that implements the text input functionality. A text editor, which is a wrapper for a text box, adds additional elements to the text box (borders and buttons).

TextBox

The text box is represented by the DevExpress.XtraEditors.TextBoxMaskBox class, which is the TextBox control’s descendant. Typically, you do not need to work with DevExpress.XtraEditors.TextBoxMaskBox controls directly. In specific cases, however, this control can be retrieved by certain functions; for example, when a text editor is focused, the form’s ActiveControl property will return the editor’s text box (a DevExpress.XtraEditors.TextBoxMaskBox object) rather than the editor itself. To get the editor, read the text box’s Parent property. To get a DevExpress.XtraEditors.TextBoxMaskBox object corresponding to a specific editor, use the TextEdit.MaskBox property.

See Also