Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Problem on Binding Double to TextBox in WPF

$
0
0

I have a textbox like this

<TextBox Text="{Binding ProductDetails.Amount, Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}" Grid.Column="3" Grid.ColumnSpan="2" Grid.Row="5"
x:Name="TextBoxAmount"/>

And I have takenAmount as Double. Its working well on integer value but when I am typing some Floating point value like 170.49 I am not able to type'.' 

TheProductDetails is  Entity and Amount is the property like this

private double _amount;
public double Amount
{
  get { return _amount; }
  set
  {
    if (_amount != value)
    {
      _amount = value;
      Notify("Amount");
    }
  }

I am not in favour of using Delay in the textbox like this as it slow my calculations as I am using 3 textboxes with commissions and percentage etc.

<TextBox Text="{Binding ProductDetails.Amount, Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}" Grid.Column="3" Grid.ColumnSpan="2" Grid.Row="5" Delay=500
x:Name="TextBoxAmount"/>

M.Sabyasachi


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>