Xceed Grid for WinForms v4.3 Documentation
TextEditor

Welcome to Xceed Grid for WinForms v4.3 > Basic Concepts > CellEditorManagers and CellViewerManagers > How to use cell editors > TextEditor

The TextEditor can be used to edit the content of cells which have a string datatype.

Using the TextEditor control

By default, the TextEditor will be created as the CellEditorManager for all columns in the grid which have a string datatype. 

The text entered into the TextEditor control can be formatted according to the mask provided by the Mask property. By default, the following mask characters are supported: 

Character Description
# Digits or white space
9 Digits only
A Alpha-numeric values only
a Alpha-numeric values or white space
@ Letters only
& Any printable character (ASCII characters from 32 to 126 and 128 to 255)
The following table provides a list of characters which are not mask characters but still affect the formatting of the text:
Character Description
> When used as the first character of a mask, it converts all inputted characters to uppercase. When used elsewhere within the mask, it is considered as a literal.
< When used as the first character of a mask, it converts all inputted characters to lowercase. When used elsewhere within the mask, it is considered as a literal.
\ The character following this character will always be considered as a literal. For example, \9 will be the 9 literal instead of the digits mask character.

The casing characters (< and >) only affect the characters entered by keyboard when they are the first characters of the mask. Casing characters located anywhere else are considered to be literals. All other characters are considered as literals. 

By default, the "_" (underscore) character is used as a prompt to indicate the format of the mask that is being used. For example, if the Mask property is set to ">@9@-9@9", then "___-___" will appear in the TextEditor to indicate that 6 characters are required, and that they are separated into 2 groups of 3 by a hyphen. The mask's prompt character can be modified by setting the MaskPromptChar property to the desired character. 

To camouflage the text that is entered, the PasswordChar property can be used. For example, setting the PasswordChar property to "*" will replace each character that is entered with a "*" rather than displaying the actual character. 

If a CellEditorManager other than the TextEditor is desired by default for columns which have a numeric datatype, the GridControl's CellEditorManagerMapping property can be modified. For example:

VB.NET Copy Code
GridControl1.CellEditorManagerMapping( GetType( string ) ) = New CustomTextEditor()
C# Copy Code
gridControl1.CellEditorManagerMapping[ typeof( string ) ] = new CustomTextEditor();

If a different CellEditorManager is required for only one column or cell, the CellEditorManager property of the specific column or cell can be set rather than changing the default CellEditorManager that is created for all string columns via the CellEditorManagerMapping property.

VB.NET Copy Code
GridControl1.Columns( "Phone" ).CellEditorManager = New CustomTextEditor()
C# Copy Code
gridControl1.Columns[ "Phone" ].CellEditorManager = new CustomTextEditor();

Underlying control

The underlying control wrapped by the TextEditor control is the WinTextBox control and is accessible through the TemplateControl property. All settings relating to the underlying control must be accessed via the TemplateControl property. Note that if a cloned instance of the TemplateControl is used to edit (refer to the CreateControlMode property and CreateControl method), the actual control that is used will be a clone of the TemplateControl and not the TemplateControl itself. In this case, the ActivatingControl event can be used to modify the cloned instances. 

More information regarding the WinTextBox control can be found in the WinTextBox control topic.