Hi Infragistics,
We have a need for an editable video timecode field in an application. We'd like to xamMaskedInput (v2014) but have hit a problem with some (optional) special characters.
The basic timecode is this...
HH:MM:SS:FF
Where...
HH = 00 - 99
MM = 00 - 59
SS = 00 - 59
FF = 00 - 24
And this mask works ok (with a PromptChar of "")...
{number:0-99}:{number:0-59}:{number:0-59}:{number:0-24}
But we would like some optional characters at the beginning and end, which the user will enter in certain situations. At the beginning we would like either a "+" or "-" and at the end a "*"
So...
[+ or -]HH:MM:SS:FF[*]
I've managed to add the "*" with the following mask at the end...
{char:1:*}
But I've tried to get "+" and "-" working and just can't seem to find a way using the standard masks...
http://es.infragistics.com/help/wpf/xaminputs_masks.html
The "-" and "+" masks already defined, don’t work for this situation.
Is it also possible to have the ":" literals in the above example only appear when the cursor has reached the correct position?
Using a PromptChar of "" the initial edit text looks like this...
::::
Which is not ideal. We've tried using a PromptChar of "0" but then the "*" mask looks odd.
It sounds like this is too custom for xamMaskedInput and maybe we need a masked control using Regex support?
Any help would be much appreciated.
Thanks Stefan.
We decided to go for a custom solution in the end, especially as there may be other situations we need to cater for in the future.
Hello,
You can try the following Mask:
{}{char:1:+- }{number:0-99}:{number:0-59}:{number:0-59}:{number:0-24}{char:1:* }
with it you will have to enter +. - or ' '(whitespace) at the beginning and * or ' '(whitespace) at the end.
Thanks Stefan,
That more what we need. The only downside is that it doesn't validate input against the regex as you type (throwing away invalid inputs). It only validates on leaving focus.
Is there anyway to achieve that behaviour do you know? I saw ValidateAsType but that doesn't seem to-do what it implies.
Thank you for your post. I have been looking into it and it seems like that it is better to use regular expression than Mask in order to achieve the functionality you want. You can set a regular expression like this:
<ig:XamMaskedInput > <ig:XamMaskedInput.ValueConstraint> <ig:ValueConstraint RegexPattern="your regEx pattern"/> </ig:XamMaskedInput.ValueConstraint> </ig:XamMaskedInput>
Please let me know if you have further questions on this matter.
Looking forward for your reply.