Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2090
XamMaskedInput: Allow only specific charaters
posted

Hello,

I need a text input that allows only a specific set of characters:

  • a-z
  • A-Z
  • 0-9
  • , (= comma)
  • - (= the minus sign)

I tried to use following mask Mask="{char:50:0-9a-zA-Z,}" but it doesn't do the trick.

Additional functionality: It would be great if the characters a-z would be set automatically into Uppercase.

Please advice how this can be achieved. I guess that the - minus sign needs to be escaped in some way.

Thanks

Niko

Parents
No Data
Reply
  • 18204
    Verified Answer
    Offline posted

    Hi Niko,

    Thank you for posting in our forums!

    Part of the issue is that you cannot start a mask with '{' with the {char} mask because WPF considers '{' to be special syntax.  Instead, you would want to use:

    Mask="{}{char:50:0-9a-zA-Z,-}"

    No escaping is needed for the '-'.  Also, the '>' character in a mask will force all following entries into uppercase.  So, you would end up using the following mask to meet your requirements:

    Mask=">{char:50:0-9A-Z,-}"

    If you have any further questions or concerns with this, please let me know.


    Sincerely,
    Michael H.
    Software Developer
    Infragistics, Inc.
    www.infragistics.com/support

Children