In my class I've a Number property
double number;
public double Number { get => number; set { number = value; OnPropertyChanged(); } }
bound to a TextBox in xaml this way:
<TextBox Text="{Binding Number, UpdateSourceTrigger=PropertyChanged, StringFormat=N2}"/>
When I launch the app, the TextBox gets 0.00 automatically, probably because the value types are initialized by default. If I TAB to give TextBox focus, it doesn't select the 0.00 so I'have to manually delete the first 0, before the decimal point, there to enter some value. If I type an integer, I get the trailing .00 as expected BUT if I press . in numeric keypad to add some decimal points after the integer part, I get a red adorner around the TextBox and the .00 doesn't get deleted! So instead of pressing . and typing digits, I've to press → to get to the decimal part first and type digits afterwards.
I want the TextBox to be blank/null when the app launches and when I hit . I want the trailing .00 to be replaced with whatever I type, ie. .25, thereafter If I press a button, to process the value in code, I want the TextBox to be blank/null again! How to do that?
Is there any masked TextBox to serve the purpose?