1
votes

I´m binding the Text-Property of a Textblock to a decimal value and want to show (format) it as f.e. "199,020.89 EUR". So i need a custom stringformat and cannot use sth like

Text="{Binding MyProp, StringFormat={}{0:C}}"

or

Text="{Binding MyProp, StringFormat={}{0:C}, ConverterCulture=de-DE}"

I need to show only 2 decimal places, a space and "EUR".

I know i can achieve the decimal places by doing the following:

Text="{Binding MyProp, StringFormat={}{0:N2}}"

But how can I furthermore add a space and "EUR" ?!

1

1 Answers

3
votes

You simply need to append ' EUR' to the StringFormat.

Text="{Binding MyProp, StringFormat={}{0:N2} EUR}"

To add the converter culture to get commas instead of periods, again you can add EUR to the format string.

Text="{Binding MyProp, StringFormat={}{0:N2} EUR, ConverterCulture=de-DE}"