I want to display a number in a Label, it should be formatted with 2 decimal places (always).
Example:
<Label Content="{Binding MyMoneyAmount}" />
If MyMoneyAmount = 100, then it should display as: 100.00 not 100.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
According to this SO Does StringFormat work on Label Content and also my own testing, StringFormat won’t work on a Label as Content is of type Object as reflected in another answer on this page.
You can use this workaround (to display for example as a currency):