0

Goals:

1) Need to put thousands(Currency commas, only commas not with any symbol like $) when displays first time as well as typing .

2) I am taking data for this textbox from Database. it should display .00 at the end. Ex: DB value: 2000 then outcome is 2,000.00

3) I set textbox length is 10. so user able to enter till 7 char, that .00 (total-3 char) cannot change anything until it reach the length of 7. once it reached 7 then it automatically point to .00 char/number that should now able to edit.

R&D:

I am able to display the text with a comma but not with .00 as suffix and this is only happens while 1st time binding(1st time). I set in string format.!

<TextBox Name="TxtInProcessdollar" Text="{Binding INPROCESSDOLLARS, StringFormat='{}{0:#,0}'}"  />

Now while tyipng its not happenning. Commas are gone.

I have tried masktextbox, this is helpful when 'Lost focus' events happen. Please suggests me what i can do to reslove this problem.

Santhosh
  • 113
  • 1
  • 3
  • 8
  • 1
    You will have to either handle keyboard events (in code-behind or better through [attached behaviours](https://blogs.msdn.microsoft.com/dgartner/2009/11/11/wpf-attached-behavior-example-watermark-text/)) , do tricky handling inside the databound property(bad idea) or use some [masked/filtered textbox](http://stackoverflow.com/questions/481059/where-can-i-find-a-free-masked-textbox-in-wpf). The latter one would be my preferred choice, though you can always implement your own solution. – Eugene Podskal Apr 09 '16 at 15:15
  • @Eugene Podskal : Thanks a lot. Let me try this one. – Santhosh Apr 09 '16 at 15:19

0 Answers0