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
680
xamMaskedEditor dynamic mask
posted

Hello

 I have a situation where I need the Value to be analysed on every keystroke, and the Mask to be dynamically generated based on what the user has typed.

I can do this by binding the Mask to a property on the viewmodel, and calling OnPropertyChanged for the mask property whenever the value is changed. However I find that at the point at which the mask is changed, I lose the last character typed into the xamMaskedEditor. Is there any way to fix this or improve my strategy?

The mask I'd like to end up with is perhaps similar to this:

"{char:5:0-9}\-{char:4:a-zA-Z0-9}\/{char:3:0-9}\\{char:2:a-zA-Z0-9}\|{char:1:0-9}"

to generate a string that looks similar to this (the length of sections between format chars (- / \ |) is variable, and not all "sections" need to be there):   1000-A1/50\2B|1     or   99-AB     or   45/60\A

I also noticed that if not all the characters are typed in, then on loss of focus the characters change position (all shift to the left).

eg type in  12_-34_/5__  becomes 123-45 on loss of focus. What if I want the characters to be in those positions... eg 12-34/5 ?

Thanks!

  • 138253
    Offline posted

    Hello,

     

    It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into your post and I can say that it is not recommended to change the XamMaskedEditor’s Mask, while you are typing in it. However you can still apply different Masks, but do this before you enter EditMode.

     

    Feel free to write me if you have further questions.