Pankaj Upadhyay
Pankaj Upadhyay

Reputation: 13574

StringFormat formatting in xaml for currency

I am using the following code Binding Path=InvoiceAmount, StringFormat={}{0:C0}snippet and its working good, as i am not interested in the fraction part. It yields the result in this manner $12. But for sake of reading, can the currency format be like this $12.00 instead of above.

I mean any rounding-off code for decimal part or any hack for such situation

Thanks in advance

Upvotes: 18

Views: 32670

Answers (3)

Scott Nimrod
Scott Nimrod

Reputation: 11595

Text="{Binding Price, StringFormat='c'}"

Upvotes: 7

NDUF
NDUF

Reputation: 707

In the application I work on, we use the following and it displays $12.00

StringFormat='{}{0:c}'

Cheers

Upvotes: 32

Marat Khasanov
Marat Khasanov

Reputation: 3848

Any Binding can be "hacked" using IValueConverter ;)

You may use format like this Binding Path=InvoiceAmount, StringFormat={}{0:C0}.00, but be careful, because this way dont care about system decimal separator.

Upvotes: 8

Related Questions