Skip to main content

TextEditBase Class

Serves as the base class for editors that have the text edit capability (e.g. TextEdit, ComboBoxEdit, DateEdit).

Namespace: DevExpress.Xpf.Editors

Assembly: DevExpress.Xpf.Core.v24.1.dll

NuGet Package: DevExpress.Wpf.Core


public abstract class TextEditBase :


The TextEditBase is the abstract class that implements basic functionality for editors that have the text edit capability.


The TextEditBase class inherits its features from the BaseEdit class.

Refer to the BaseEdit class description for information on derived features and API.

Editor Value

The Text property contains the text displayed within the editor. To get the currently displayed text (while the end user types), use the EditText property.

You can limit the maximum number of characters an end user can enter into the editor using the MaxLength property.

Useful API

Text Operations

The TextEditBase class has the following methods for text operations:

Text Selection

Set the SelectAllOnGotFocus property to true to enable automatic text selection when the Tab key is pressed to focus the editor. To enable text selection when a mouse click focuses the editor, set the SelectAllOnMouseUp to true.

To select all text within the editor manually, use the SelectAll method. To select only the specified amount of text, use the TextEdit.Select(System.Int32,System.Int32) method.

Trimming and Wrapping

An editor’s text content is trimmed when it exceeds the editor’s edges in display mode. Use the TextTrimming property to change this behavior. The TextTrimming property has no effect unless the TextEditBase.TextWrapping property is set to NoWrap.

If text wrap is enabled, the text editor can display multiple text lines. The LineCount property gets the total number of text lines.

Useful API

Embedded Labels

Specify the Label property to display a caption inside the editor. This caption moves upward when the editor is focused:

Data Editors - Labels

<dxe:TextEdit Label="First Name"/>
<dxe:TextEdit Label="Last Name"/>
<dxe:TextEdit Label="Full Name"/>
<dxe:DateEdit Label="Birth Date"/>
<dxe:TextEdit Label="Title"/>
<dxe:ComboBoxEdit Label="Prefix"/>

Label Position

An empty and unfocused editor displays its label in the middle. The editor displays this label at the top in the following cases:

Access Keys

You can place an underscore (_) character into label text. The following character defines an Access Key. When a user presses the Alt + Access Key combination, the editor gets focus.

<dxe:TextEdit Label="_First Name"/>
<dxe:TextEdit Label="_Last Name"/>
<dxe:TextEdit Label="Full _Name"/>
<dxe:DateEdit Label="_Birth Date"/>
<dxe:TextEdit Label="_Title"/>
<dxe:ComboBoxEdit Label="_Prefix"/>

Appearance Customization

Refer to the following topic for more information: Appearance Customization.

See Also