I have a WPF application with a DataGrid which is bound to an ObservableCollection. The collection type is a class which contains one or more properties of type double for decimal values. In the XAML i have defined DataGrid-Columns like that:
<DataGrid.Columns>
<DataGridTextColumn x:Name="col_LowerBound"
Binding="{Binding LowerBound, NotifyOnTargetUpdated=True, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
Header="Lower bound"/>
</DataGrid.Columns>
As You can see, i'm using the UpdateSourceTrigger LostFocus instead of PropertyChanged. In case of PropertyChanged the input is checked all at once and a character like "." would cause an inplausibility. By using LostFocus i'm able to input decimals with dot.
Now i want to input comma too and replace it with dot. Can i make that replacement while the KeyDown- or PreviewKeyDown-event and how? I don't know how to do replace values while KeyDown and a similar case with TextBox is no great help.