WPF Binding DataGridTextColumn Does Not Accept Decimals

I do not understand what the problem is. Binding has the Decimal property. Here is the XAML:

<DataGridTextColumn Header="Price" Binding="{Binding Price, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged} Width="*"/> 

I literally can't type '.' the character. Why does this stop me from typing this character and how can I tell me to do it.

I tried to make the string format as follows:

 <DataGridTextColumn Header="Price" Binding="{Binding Price, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, StringFormat={}{0:n2}} Width="*"/> 

But this does not solve my problem, because everything she does adds “.00” to the end of what I type.

All I need is permission to enter a period.

UPDATE:

I was sent here . I removed the UpdateSourceTrigger property and this allowed me to enter ".". I do not have installed version 4.5 Beta, and my localization settings are correct. So now my question is how to get a DataGridTextColumn so that I can enter ".". with the UpdateSourceTrigger property set?

+8
c # wpf xaml datagridtextcolumn
source share
1 answer

UpdateSourceTrigger = PropertyChanged repeats the text each time a key is pressed. A number that ends in a decimal point is not valid. Change UpdateSourceTrigger to LostFocus (similar to uninstalling) or try typing '.' while after it there are other numbers.

+14
source share

All Articles