I have a funny problem with Float
data type and UpdateSourceTrigger
in WPF
.I have a property with float data type and bind it to a TextBox
and set UpdateSourceTrigger
of the Binding to PropertyChanged
,but WPF
dosen't let me type '.' in the TextBox
unless i change UpdateSourceTrigger
to LostFocus
.I think it's because of we can not type '.' in the end of float value.I don't have any idea how can i fix it because i need to type '.' and set UpdateSourceTrigger
to PropertyChanged
.
The property is:
public float? Amount
{
get;set;
}
And in the XAML:
<TextBox
Text="{Binding Amount , UpdateSourceTrigger=PropertyChanged}"/>