Format waluty na postawie systemu
1) In app.xaml override OnStartup() and add
2) Define in XAML @ Window level -
xmlns:sysglb="clr-namespace:System.Globalization;assembly=mscorlib"
3) In XAML
<TextBox Text="{Binding Path=Price, StringFormat='{}{0:C}', ConverterCulture={x:Static sysglb:CultureInfo.CurrentUICulture}}" />
This correctly picks up any custom regional settings. Although I'm using a manually created CultureInfoin the first step, I'm sure it's possible to pass in one of the static types - eg.System.Globalization.CultureInfo.CurrentCulture (I haven't tested it though...)
Kategoria:
- Zaloguj się aby dodać komentarz.