If only 0 must be displayed without decimals, then try these formats: StringFormat={}{0:0.00;-0.00;0}.
Maybe StringFormat={}{0:0.##} is suitable too.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi, I am binding an object to a TextBox with the following XAML:
<TextBox x:Name="Amount" Text="{Binding Path=Amount, StringFormat={}{0:N2}, UpdateSourceTrigger=PropertyChanged}" />
When I open the window the Text property is set to 0.00. I have several of these TextBoxes, which makes it tedious to delete every value before entering a new one.
Is there a neat way to keep the format and delete the zeros?
If only 0 must be displayed without decimals, then try these formats: StringFormat={}{0:0.00;-0.00;0}.
Maybe StringFormat={}{0:0.##} is suitable too.