CustomTextMaskInputArgs.SetResult(String, Int32, Nullable<Int32>) Method
Sets the final editor text, selection anchor, and cursor position.
Namespace: DevExpress.Data.Mask
Assembly: DevExpress.Data.v24.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
editText | String | The final editor text. |
cursorPosition | Int32 | The final cursor position. |
Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
selectionAnchor | Nullable<Int32> | null | The final position of the selection anchor. |
Remarks
After you have checked the current editor text (CurrentEditText) and the edit a user attempts to perform (ResultEditText), call the SetResult
method to set the final editor text. The code below illustrates how to capitalize all letters entered by a user, and reject characters that are not Latin letters.
protected override void ProcessCustomTextMaskInput(CustomTextMaskInputArgs args) {
if (args.ActionType == CustomTextMaskInputAction.Init) return;
var textInfo = CultureInfo.InvariantCulture.TextInfo;
if (Regex.IsMatch(args.InsertedText, @"^[a-zA-Z]+$"))
args.SetResult(textInfo.ToUpper(args.ResultEditText), args.ResultCursorPosition);
else args.Cancel();
}
See Also