質問

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

役に立ちましたか?

解決

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.

他のヒント

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 = "€";

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top