Is there any decent way to get a WPF control which is bound to a decimal value?
When I just bind the TextBox or DataGridTextColumn to a decimal, data entry sucks big time.
<TextBox Text="{Binding MyDecimal, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"/>
When I try to enter "0,5" in this TextBox I'll get "5" as a result. It is nearly impossible to enter "0,5" at all (Apart from entering 1,5 and replacing the "1" with a "0").
When I use StringFormat data entry still sucks small time:
<TextBox Text="{Binding MyDecimal, StringFormat=F1, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"/>
Now when I try and enter "0,5" I'll end up with "0,5,0", which still is wrong but at least I can remove the trailing ",0" without much Problems.
Still, entering decimals using WPF sucks big time because this entry fields are very prone to data entry errors, which is a real pain especially for values!
So what am I supposed to use for decimal data entry in wpf? Or does Microsoft not support decimal data??
This will allow only decimals to be entered into the textbox and nothing else.
The viewmodel looks like this:
The XAML usage looks like this:
I currently use this behavior for digital and decimal input:
The XAML usage looks like this: