Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Collapse]Editors and Simple Controls
   [Collapse]Simple Editors
    [Expand]Included Components
    [Collapse]Editors Structure
      Editor Hierarchy
      Editor Class Structure
      Editor Containers
      Repositories and Repository Items
      Custom Editors
    [Expand]Editors Features
    [Expand]Member Tables
    [Expand]Examples
   [Expand]Lookup Editors
   [Expand]Token Edit Control
   [Expand]Breadcrumb Edit Control
   [Expand]Range Control
   [Expand]Image Slider
    Camera Control
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Editor Class Structure

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.

Expanded 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.

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.

Expanded 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).

The text box is represented by the DevExpress.XtraEditors.TextBoxMaskBox class, which is the System.Windows.Forms.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.

Expanded See Also

How would you rate this topic?​​​​​​​