in an actual project I have the following problem. I use:
-MaskToken (For Example: #9.2)
The user can't write more than 11 numeric digits in it. Thats ok, but if he copy & paste a value with more digits in it, it appears in the
DataRow behind (See attached file). Even if AllowInvalidValues equals to false.
Its a workaround to prove the length by every input, but thats not really what the developer expects. In a business application with over hundreds of elements a developer will not check everytime if the length of the value is correct, so this can't be the right way.
*Don't know if it appears by other "MaskedInput"-controls
7 Answers, 1 is accepted
RadMaskedNumericInput is designed to work with doubles and RadMaskedCurrencyInput is designed to work with decimals which have higher precision rates. From the picture it seems you need to display a currency. Is it possible for you to try a CurrencyInput (bound to decimal value) instead of NumericInput with doubles ? Let us know if you experience any similar issue with CurrencyInput.
we (colleagues from the company I work) tried it with every MaskedInputControl. But with every Control where we pasted a value that shouldn't be allowed cause of the MaskToken, was then in the DataRow, like it is shown in the picture. :(
From the snapshots I am no sure what is the copied value. Could you please elaborate more on he exact steps your perform? For example you copy "123456" and you paste it in MaskedNumericInput with Mask="#9.2" when the caret is on index x and the value currently is y. Also let us know what you expect to happen - which value you expect to be pasted / coerced. Thank you in advance for your cooperation.
Here is a step by step explaination:
1.) Create RadMaskedNumericInput with a MaskToken (using MVVM for example) :
2.) Create Proberty "Test":
3.) Start the engine
Here are the description for the attached files:
Bild1 = Start the programm, look at this amazing and beautiful RadMaskedNumericInput element
Bild2 = Write the following number in it: 2.345,67 - Yeah it works. Only this number of letters is possible.
Bild3 = Get a number with more letters. For Example: 12.345,67
Bild4 = Make a breakpoint by the setter method of the proberty and paste the new number into the field - tadaaa the problem appears = 12.345,67 is in the value. More than allowed by the MaskToken
Bild5 = But in the field you see only this number: 2.345,67
That has nothing to do with a "Numeric" or "Decimal" Input. This happens even with a string and a RadMaskedTextInput.
In my opinion the expected behavior is that the field only inputs this number 2.345,67 and cuts off the 1. (JMO)
Hopefully this helps you.
By pasting a number in MaskedInput control or TextBox , at first in the setter of the bound property you will receive the number / string you are trying to paste / input. It's totally expected for this setter to fire, because the Value of the RadMaskedInput control is two-way bound and passes several coercing / parsing processes. Actually the produced value will be just the one you expect 2345.67 - the setter will finally fire with the 2345.67 and the Value property of the control will hold the number 2345.67. If you need detection that Value is changed only with the final Value of this whole process - you can subscribe to ValueChanged event of the RadMaskedNumericInput.
thanks for anwsering my question.
So when I write something into the field the setter method fires only one time cause of the masktoken but by copy and paste it fires twice cause the masktoken comes then at second place...!?!? that isn't gonna make it easier... :( And it isn't a good solution for this problem. How should I handle the inputs with this behavior by over hundres of elements in the application? Always split the Int/String etc.? mmmmmhhhh, no, not good.
The Problem is that many elements with a asynchrone method behind, search in the database for a correct entry. And this gives me/the user everytime a error mesage cause the field in the database has the same mask...
And to set the timer for the asynchrone method later than it is right now, shouldn't be a solution, too.
You scenario seems very complex and we miss many details from its implementation. However, we are almost sure there is a possible solution that is not dependent on the number of times setter fires.
You can try UpdateSourceTrigger = LostFocus on the Binding or Mask="dddd.##" if your architectureallows this.