ComponentOne Basic Library for UWP
Basic Library Overview / Input for UWP / Working with Input for UWP / Working with C1MaskTextBox / Mask Formatting
In This Topic
    Mask Formatting
    In This Topic

    You can provide input validation and format how the content displayed in the C1MaskedTextBox control will appear by setting the C1MaskedTextBox.Mask property. MaskedTextBox for UWP supports the standard number formatting strings defined by Microsoft and the C1MaskedTextBox.Mask property uses the same syntax as the standard MaskedTextBox control in WinForms. This makes it easier to re-use masks across applications and platforms.

    By default, the C1MaskedTextBox.Mask property is not set and no input mask is applied. When a mask is applied, the C1MaskedTextBox.Mask string should consist of one or more of the masking elements. Other elements that may be displayed in the control are literals and prompts which may also be used if allowed by the C1MaskedTextBox.TextMaskFormat property.

    The following table lists some example masks:

     

    Mask

    Behavior

    00/00/0000

    A date (day, numeric month, year) in international date format. The "/" character is a logical date separator, and will appear to the user as the date separator appropriate to the application's current culture.

    00->L<LL-0000

    A date (day, month abbreviation, and year) in United States format in which the three-letter month abbreviation is displayed with an initial uppercase letter followed by two lowercase letters.

    (999)-000-0000

    United States phone number, area code optional. If users do not want to enter the optional characters, they can either enter spaces or place the mouse pointer directly at the position in the mask represented by the first 0.

    $999,999.00

    A currency value in the range of 0 to 999999. The currency, thousandth, and decimal characters will be replaced at run time with their culture-specific equivalents.

     

    You can set the C1MaskedTextBox.TextMaskFormat property to one of the following elements to define what is included in the mask:

     

    Option

    Description

    IncludePrompt

    Return text input by the user as well as any instances of the prompt character.

    IncludeLiterals

    Return text input by the user as well as any literal characters defined in the mask.

    IncludePromptAndLiterals

    Return text input by the user as well as any literal characters defined in the mask and any instances of the prompt character.

    ExcludePromptAndLiterals

    Return only text input by the user.

    The following topics detail mask, literal, and prompt elements that can be used or displayed.

    See Also