Sep 11
27
How to Format a Number in a C# WPF Binding
Leave a comment »
A number can be formatted in a XAML binding. The following GridViewColumn will be formatted to currency with two decimal points and a currency symbol:
DisplayMemberBinding="{Binding Amount, StringFormat=C}"
There are many formatters available for example:
DisplayMemberBinding="{Binding Amount, StringFormat=N2}"
This would format the number to two decimal places without the currency symbol.
