Is there a way to create a custom mask with my own valid characters?
I need to allow spaces AND be required, so a-z, A-Z, ' ', or 0-9
"A" is closest, Alphanumeric character placeholder. For example: a-z, A-Z, or 0-9. Character entry is required.
but does not allow for spaces
Regards
Eric
Hello Eric,
There are different approaches to solve this task. Maybe you could try one of these two options below:
Option 1: You could try to use Regular Expressions (RegEx). Using suitable event, you could validate the entered characters.
Option 2: You could try to implement IEditorDataFilter
Please take a look on attached video file and both samples with these two approaches and if you have any questions, feel free to write me
Sample 1
Sample 2
Thanks for the examples but they are not for masks, they only validate on leave.
Is there any interface to override for the mask that I can implement my own and extend "A"?
Also can't seem to find a e.Handeled in
IDUltraMaskedEdit_InvalidChar(object sender, Infragistics.Win.UltraWinMaskedEdit.InvalidCharEventArgs e)
Is there another event I can subscribe to?
Could you please give us a sample about desired mask. Did you try to set properties
- EditAs = UseSpecificMask
-Input Mask = aaa aa aaa aa aa
By this way you will be able to enter letters and digits with empty space. More details about the masks you could find at: http://help.infragistics.com/Help/Doc/WinForms/2012.2/CLR4.0/HTML/WinGrid_Formatting_Cells_Containing_Specific_Number_of_Characters.html
About your question for suitable event. At that moment we have not InvalidChar event, but maybe you could handle one of these events below:
- ultraMaskedEdit1_TextChanged
- ultraMaskedEdit1_ValueChanged
- ultraMaskedEdit1_Validating
Let me know if you have any further questions
If you need any additional assistance don’t hesitate to ask.
Thanks for the details. In that case, maybe you could use these settings:
EditAs = UseSpecifiedMask
InputMask =&&&-&& instead of AAA-AA
About InputCharBase class, it is abstract class, so if you want you could inherited / override this class (or some of other existing classes), but I do not think that it is a simple approach.
Let me know if you have any question.
Yes, I set the InputMask property and it is working but I need to allow additional chars, a space
"A" - Alphanumeric character placeholder. For example: a-z, A-Z, or 0-9. Character entry is required.
I have it set to AAA-AA
Since "A" does not allow " ", it fires the InvalidChar event but I have no way to handle it, so I need to set up my own char[] of allowable chars
So a valid entry could be
q q-ww
which "A" does not allow
Maybe implement InputCharBase and pass that?