Skip to main content

Inplace Editors

  • 4 minutes to read

The Tree List control lets you assign in-place editors to data cells. This is useful when you need to display different types of data (images, for instance), or when you need to facilitate end-user input. You can use any of the editors supplied by the DevExpress Editors Library library, or create a custom one if none of the standard editors meet your requirements. This section lists the ways in which in-place editors can be assigned to columns or individual cells.

Along with using the editors supplied with the DevExpress Editors Library, you can also use custom editors to edit cell values. The editor must be derived from the BaseEdit class. Custom editors can also be derived from any of the DevExpress Editors Library if it is necessary to extend their functionality. Please refer to the Custom Editors topic, for complete information on creating custom editors which you can use for standalone and in-place editing.

Inplace Editors Overview

The Tree List control lets you assign in-place editors to data cells. This is useful when you need to display different types of data (numeric or date-time values, images, etc) or when you need to facilitate end-user input. You can use any of the editors supplied by the DevExpress Editors Library, or create a custom one, if none of the standard editors meet your needs. The image below shows a sample Tree List with different editors assigned to each column.

cdInplaceEditors_all

As seen in the image above, editor buttons are shown for the focused node’s cells. The manner in which editor buttons are displayed within a Tree List is specified by the TreeList.ShowButtonMode property. The available display modes for the editor button are listed in the ShowButtonModeEnum topic.

Editors are supplied to the Tree List control by means of repositories, which are repository item collections. A repository item stores the properties and event handlers for a single editor. Using those settings, repository items are capable of creating fully functional editors ready for editing cell values.

There are two types of repositories providing editors for the XtraTreeList. The first is the Tree List’s internal repository. You can access this repository at runtime using the Tree List’s EditorContainer.RepositoryItems property. At design time, the Tree List offers you a convenient dialog for customizing the repository. It is available via the designer’s Repository Editor page. Note that the internal repository should only contain the editors which are used in the XtraTreeList, and not used by other controls. If you need to use the same editor (repository item) within several controls, you should use the PersistentRepository component, which serves as an external repository. To bind an external repository to a Tree List, use its EditorContainer.ExternalRepository property. Note that data cells can use editors supplied by internal and external repositories. Refer to the Editors and Simple Controls for additional information.

Editors can also be assigned to node cells using the following methods:

  • Assigning Editors to Columns

    This is the most used approach, as typically, data fields contain values of the same type, and so require only a single editor for all their values.

  • Assigning Editors to Individual Cells

    This method is used when fields contain data of various types. For instance, the dataset supplied may contain data where fields serve as records, while records serve as data fields.

When a user edits cell data, the TreeList.ActiveEditor property returns this cell’s editor.

Default Editors

If an editor hasn’t been explicitly specified for a column, the column uses the default editor. The type of the default editor depends upon the bound data field’s type. Columns bound to DateTime fields use date editors by default, columns bound to Boolean fields use check editors and in all other cases, text editors are used.

Note that default editors are not added to the Tree List’s internal repository and you cannot change their settings at runtime. These editors are created dynamically when requested, so they always have the default behavior. This means that if you need to use a customized check box editor for a Boolean column, you should still create the corresponding repository item and explicitly assign it to the desired column. This is true for all types of default editors.

Task-Based Help

Member Tables

See Also