I have a textbox in my WPF UI where the user can input double values. This textbox is bound to a double value in my data model. I want to show a validation error when the user enters three or more decimal places into the textbox. I count zeros as decimal places as well. So a number like 1.000 or 0.000 shall trigger the validation error as well.
I want to do the validation logic with a SelfValidation ruleset in the bound class (so no external validation). The problem is that I cannot get the original user input from the textbox, because it is converted into a double which I work with. So when the user enters 1.000 I get 1.0 as a value to validate.
How can I find out how many decimal places the user originally entered so that my class can validate as desired? Can I solve this with a converter which somehow persists the information of original number of decimal digits?