[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [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
    [Expand]Editors Structure
    [Collapse]Editors Features
      Text Editing Overview
     [Expand]Input Mask
     [Expand]Format and Parse Editor Values
     [Expand]Editor Buttons
     [Expand]Dropdown Editors Overview
      Image Editing Menu
     [Expand]Data Binding Overview
     [Expand]Appearance Customization
     [Expand]Miscellaneous Features
    [Expand]Member Tables
   [Expand]Lookup Editors
   [Expand]Token Edit Control
   [Expand]Breadcrumb Edit Control
   [Expand]Range Control
   [Expand]Image Slider
    Camera Control
    Templated ListBox Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Text Editing Overview

Most of the editors in the XtraEditors library are derived from the TextEdit class, and thus, provide text boxes. This topic describes how to use text boxes, apply selections and work with the Clipboard. This functionality is implemented solely by the TextEdit class. Note that descendants may only use part of this functionality or may not use it at all.

Expanded Text Editing Basics

End-users can navigate through the text using either the keyboard or the mouse. The LEFT and UP arrow keys move the caret forward while the RIGHT and DOWN arrow keys move the caret backwards. If the CTRL key is pressed when pressing an arrow key, the caret moves to the next or previous space character found. The HOME and END keys can be used to move the caret before the first character or after the last one respectively. To change the caret position via code, use the TextEdit.SelectionStart property.

All common text editing features are available in text editors. This includes typing characters, deleting them using the BACKSPACE or DEL keys, etc. Note that end-users can press the CTRL+DEL combination to remove the editor's entire content.

To change the editor value via code, you should assign a value to the BaseEdit.EditValue or BaseEdit.Text property. Changing an editor's value raises its RepositoryItem.EditValueChanging and BaseEdit.EditValueChanged events. Handle them to control user input.

You can limit the number of characters that can be entered by end-users by using the RepositoryItemTextEdit.MaxLength property. You can apply an editor mask for more control of end-user input. This will restrict end-users to the characters allowed by the mask. Masks can be applied to editors using the RepositoryItemTextEdit.Mask property. For detailed information on applying masks, refer to the Input Mask topic.

A text editor can be used for entering passwords. To do so, set the RepositoryItemMemoEdit.UseSystemPasswordChar property to true, or assign a character to the RepositoryItemTextEdit.PasswordChar property.

Expanded Selections

Selections can be applied using the mouse and keyboard. To select a text portion within a text box, end-users must place the caret at the start of the text to be selected, and then use the navigation keys while pressing the SHIFT key (please refer above for details about the navigation keys available). To select the editor's entire content, or to remove the selection, use the F2 key. To select a word (a sequence of characters between two spaces), end-users should double-click it.

If you need to select a portion of text via code, use the TextEdit.SelectionStart and TextEdit.SelectionLength properties. To select the editor's entire content, or to clear the selection, use the TextEdit.SelectAll and TextEdit.DeselectAll methods. You can access the selected text using the TextEdit.SelectedText property. Strings assigned to this property will replace the current selection.

Expanded Built-In Context Menu (Undo and Clipboard Operations)

Text editors offer a built-in context menu that enables end-users to undo the last action, perform Clipboard operations and select the editor's entire content. All these actions can also be performed using shortcuts or code.

Menu Item Action Shortcut Member
Undo Restores the previous value. CTRL+Z TextEdit.Undo
Copy Copies the selected text to the Clipboard. CTRL+C, CTRL+INS TextEdit.Copy
Paste Pastes the Clipboard content. CTRL+V, SHIFT+INS TextEdit.Paste
Cut Copies the selected text to the Clipboard and removes it. CTRL+X, SHIFT+DEL TextEdit.Cut
Delete Deletes the selected text. DEL, BACKSPACE TextEdit.SelectedText
Select All Selects all text within the editor. CTRL+A TextEdit.SelectAll

Expanded See Also

Is this topic helpful?​​​​​​​