I will start by saying that I am completely new to WPF. I am trying to learn and diagnose an existing application and I had a question I was hoping someone could answer.
I noticed when a user enters a percentage, it requires the user to enter a decimal value (which makes sense), but then it displays it as a percentage like if the user enters .50 it is displayed in the cell as “50%” (after leaving the cell of course). The reason it behaves this way is obvious to me, because the format is set to “{0:P}”.
I wanted to allow the users to enter “50 %” so I created a converter (that for instance converts “50 %” to .5 and it works great).
What puzzles me is why isn’t a converter needed for the currency fields (Format = “{0:C}”)? I am surprised that the DataGrid allows the user to enter dollar signs, commas, etc and then coverts them to a decimal (money type in SQL).
Is there some automagic stuff going on with the Currency Format (or some other property that I just haven’t found in the code yet) or is there a Converter somewhere that I haven’t discovered?
How is this working and if it is some automagic stuff, why isn’t percentages handled automagically in a similar manner?
I just ran across this issue. Since no one has provided an answer in 9 months, I’m going to give my best guess. There appears to be a built in currency converter (see this answer) and I suspect somehow the FormatString for currency uses this built-in converter behind the scenes. The built in ZoomPercentageConverter doesn’t appear to do what’s needed so I’m guessing the P StringFormat is just dumber, too bad.