Meghana B

Meghana B

  • NA
  • 50
  • 9.2k

textbox should take one comma only

Aug 30 2022 12:14 PM

 I'm using my decimal Textbox like this:

<TextBox x:Name="TextBox"  KeyDown="TextBox_KeyDown"  
        Style="{StaticResource MeuTextBoxValor}" Height="23" Margin="1"   
        Text="{Binding Peso,  NotifyOnValidationError=true,  StringFormat={}{0:#0.00##}, 
    ConverterCulture='pt-BR', 
UpdateSourceTrigger=PropertyChanged}" 
VerticalAlignment="Center" Width="120" />

When you put a comma in this field it stays like this 0, 00

And when he starts to write he writes like this 0.22,00

I'd like to take this, "00" right. I already tried to give TextBox.Text.Replace(",00","") but he keeps putting it.

 


Answers (2)