8

I am using Xamarin Forms (XAML) at a project where I need to show a price. To show the correctly formatted price I am using StringFormat like:

<Label Text="{Binding Price, StringFormat='{}{0:C}'}"/>

The result depends on the culture of the device the app is running (German: €, American: $, ...). My goal is always to use the German culture. Based on adrianbanks answer this is possible in WPF. I tried to use this approach like

<Label Text="{Binding Price, StringFormat='{}{0:C}', ConverterCulture='de-DE'}"/>

but the result is the following XamlParseException:

Xamarin.Forms.Xaml.XamlParseException: Cannot assign property "CultureInfo": Property does not exists, or is not assignable, or mismatching type between value and property

It seems like Xamarin Forms does not provide this. I searched a lot but found no solution how to set the culture of the formatter in XAML. Is there a wy to solve my problem without implementing my own converter?

Community
  • 1
  • 1
Fruchtzwerg
  • 10,999
  • 12
  • 40
  • 49

0 Answers0