The TextViewer can be used to view the content of cell's which have a string datatype. A TextViewer is not assigned as the default CellViewerManager when cell's have a string datatype.
By default, cell's that have a string datatype paint their own values using the ToString method. If a CellViewerManager is desired for cell's which have a string datatype, a TextViewer can be assigned to the column or cell's CellViewerManager property, or the TextViewer can be added as the default CellViewerManager for column's which have a string datatype through the GridControl's CellViewerManagerMapping property. For example:
VB.NET | Copy Code |
---|---|
'Create TextViewer by default for all columns which have a string datatype. |
C# | Copy Code |
---|---|
//Create TextViewer by default for all columns which have a string datatype. |
The text displayed by the TextViewer 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.
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.
The text as it is displayed by the TextViewer can be retrieved using the GetText method. The string that is returned will be formatted according to the values of the cell's FormatProvider and FormatSpecifier properties.
The underlying control wrapped by the TextViewer is the WinTextBox control and is accessible through the Control property. All settings relating to the underlying control must be accessed via the Control property.
More information regarding the WinTextBox control can be found in the WinTextBox control topic.