Hello,
I'm using a XamMaskedEditor to mask a numeric value ("nnn.nn") for example. Before the user enters text this is displayed in the text box:
___.__
That is correct. When the user type the number 6 before the decimal point, for example, and then presses tab, the following is shown in the text box:
6.00
However, instead of the 'Text' property (which I'm binding too) being "6.00" it is actually just "6". Is this a bug or is there something I'm doing wrong?
Hi,
I wasn't able to reproduce your issue. Look at the attached project.
Regards,
Anastas
Hi Anastas,
Thanks for looking at this. If you set the 'IsAlwaysInEditMode' property on the XamEditor to true, then you can replicate this behaviour. It turns out that in my case I don't need this set to true so you've managed to solve my problem. Is this how 'IsAlwaysInEditMode' is meant to work?!
Ben
The Text contains the string of the currently entered characters taking the DataMode into consideration. While you are typing you only have the characters you have entered. Note, normally you would bind to the Value property which will return the numeric value (based on the ValueType) or null if nothing is entered. Is there a reason you want to bind to the string Text property? Assuming the property you are binding to is not a string field that would mean the string would have to be parsed by the wpf framework back to the numeric value which you could have gotten using the Value property.
We've got 3 XamMaskedEditors and combine the text values of each so it's better for us to use Text property rather than convert a number back to a string.
Our scenario does work if 'IsAlwaysInEditMode' is set to False, so I'm guessing that something behind the scenes sets the Text property to the value (including mask) when you lose focus (i.e. come out of edit mode) but when 'IsAlwaysInEditMode' is set to true, this never happens.
For our purposes it happens that we don't need 'IsAlwaysInEditMode' set to true so I don't have the problem anymore, I just wasn't sure if this was the correct behaviour or not...