ComponentOne Basic Library for UWP
Basic Library Overview / Input for UWP / Input for UWP Task-Based Help / C1MaskedTextBox Task-Based Help / Adding a Mask for Currency
In This Topic
    Adding a Mask for Currency
    In This Topic

    You can easily add a mask for currency values using the C1MaskedTextBox.Mask property. By default the C1MaskedTextBox control starts with its C1MaskedTextBox.Mask not set but you can customize this. For more details about mask characters, see Mask Elements.

    At Design Time

    To set the C1MaskedTextBox.Mask property, complete the following steps:

    1. Click the C1MaskedTextBox control once to select it.
    2. Navigate to the Properties tab and enter "$999,999.00" in the text box next to the C1MaskedTextBox.Mask property.

    This will set the C1MaskedTextBox.Mask property to the number you chose.

    In XAML

    To set the C1MaskedTextBox.Mask property add Mask="$999,999.00" to the <Xaml:C1MaskedTextBox> tag so that it appears similar to the following:

    Markup
    Copy Code
    <Xaml:C1MaskedTextBox Height="23" Width="120" Name="C1MaskedTextBox1" Mask="$999,999.00"></Xaml:C1MaskedTextBox>
    

    In Code

    To set the C1MaskedTextBox.Mask property add the following code to your project:

    Visual Basic
    Copy Code
    C1MaskedTextBox1.Mask = "$999,999.00"
    

     

    C#
    Copy Code
    c1MaskedTextBox1.Mask = "$999,999.00";
    

    Run your project and observe:

    The mask will appear in the control. Enter a number; notice that the mask is filled.

    See Also