Question

IS there any way, using the dataformatstring, to move the Euro (€) currency symbol to the beggining of the value without hardcoding the euro symbol in the xml?

Example : Using {0:C} I get 1234€ and what i want is to get €1234 . I can't find a solution for this without having to hardcode de euro symbol like €{0:g} .

Any clue ?

Regards

Was it helpful?

Solution

You need to set the CurrencyPositivePattern to 0:

NumberFormatInfo nfi = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();
nfi.CurrencyPositivePattern = 0;

You will likely want to set the CurrencyNegativePattern as well. The link provides all of the patterns.

OTHER TIPS

It would seem safest to specify the default currency symbol.

As whatever your defualt culture is (e.g in case of French Currrency there is a dual currency either it can be the local currency or euros)

NumberFormatInfo numberFormatInfo= (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone(); numberFormatInfo.CurrencySymbol = "€";

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top