Fredi Tansari
Fredi Tansari

Reputation: 95

format values in datagrid to other currency

I need to ask follow up question from this thread This thread

how to change the currency to other format, ie. in my case using Indonesian Rupiah (IDR)

Upvotes: 1

Views: 583

Answers (3)

Fredi Tansari
Fredi Tansari

Reputation: 95

I finally found the solutions and I went with this way.

 <sdk:DataGridTextColumn x:Name="unitPriceColumn" Binding="{Binding UnitPrice, StringFormat=C, ConverterCulture=id-ID}" Header="Unit Price" Width="SizeToHeader"/>

You can also set the current culture to the current thread

Upvotes: 0

Jozef Benikovsk&#253;
Jozef Benikovsk&#253;

Reputation: 1141

To display currency you need basically two things:

  • currency formatting rule saying where and how the currency symbol is placed by the number, how the negative numbers are represented etc. - this is performed using CultureInfo and in XAML by setting ConverterCulture in Binding
  • set the proper currency symbol - if it is the same as your CultureInfo.NumberFormat.CurrencySymbol, than you have nothing to worry about otherwise you have to create copy of CultureInfo and change it

Upvotes: 0

Chris W.
Chris W.

Reputation: 23280

You'll need to go with setting your CultureInfo or if it's for single instance you can just apply it via a StringFormat like;

Binding="{Binding Blah, StringFormat='Rp\{0\}'}"

Upvotes: 1

Related Questions