TextBox Won't Allow me to enter in a decimal

c#, xaml

Solution

A cheap work-around (if you still want to keep the built-in validation and binding to a nullable property), is to add a small `Delay` within the binding. This allows you to actually enter in a 'decimal' point, and after the 'delay' it binds, then evaluates the value as correct.

Example:

  <TextBox Text="{Binding SebAmountPer, UpdateSourceTrigger=PropertyChanged, TargetNullValue='', Delay=350}" Height="75" Width="300" TextWrapping="Wrap"/>

Problem

I can Enter Numbers into the text box but it won't allow me to enter decimal values. May I ask why is this? ``` <TextBox Text="{Binding SebAmountPer, Mode=Twoway, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="2" TextWrapping="Wrap"/> public decimal? SebAmountPer { get { return _seb.SEBAmountPer; } set { _seb.SEBAmountPer = value; OnPropertyChanged("SebAmountPer"); OnPropertyChanged("SebTotal"); } } ```

Original source