11 Aug 2016 14:04
MaskedInput: Change the InputBehavior when deleting digits after the decimal symbol
Change the InputBehavior when deleting digits after the decimal symbol: For example if the cursor position is marked with '|': Enter: 1234,56|78 (press 'del') Result: 1234,560|8 - change this behavior so that the result can be 1234,56|8.
We can split the request into 2 desired results. Input: 1234.56|78. Pressing Delete
1) Produces Value 1234.5680 but NOT 1234.5608
Solution: Can be achieved with using No-Mask, FormatString and overriding MaskedNumeric/Currency Input and the protected method ReplaceChar. This is demonstrated in the attached sample.
2) (1) is True + Last zero is removed => 1234.568 but NOT 1234.5680
Solution: 2 is tightly coupled with changing the FormatString or Mask dynamically. There is no way to see number 123.456 if the Mask is "x.4" or the Mask is "" + format string is "n4". To see 3 digits only after the decimal point you need to change the Mask to "x.3" or the FormatString (in no-masked scenario) to "n3". This cannot be built-in feature because it changes a public property set by the client. So, this is custom behavior, it is also demonstrated in the SDK demo DynamicFormatString (it is pushed in GitHub with Q2 2014 Release)