views:

29

answers:

1

I have an odd problem in silverlight. I use the following XAML to bind the content of a label to a double property in my viewmodel.

Content="{Binding FeePeriodActual, Mode=OneWay,StringFormat=\{0:c\}}"

However, the display string always shows the $ Dollar Currency symbol rather than the the £. This is the same on the production server and the dev machine. All localisation properties are set right on the webserver(s). I can't see where to change it in the silverlight app.

Anyone got any ideas?

A: 

Modify the Application_Startup method in App.xaml.cs to look like this:-

private void Application_Startup(object sender, StartupEventArgs e)
{
  Resources.Add("DefaultCulture", System.Globalization.CultureInfo.CurrentCulture);

  this.RootVisual = new MainPage();
}

Now where you need culture specific formatting in bindings use:-

Content="{Binding FeePeriodActual, Mode=OneWay,StringFormat=\{0:c\}, ConverterCulture={StaticResource DefaultCulture}}"
AnthonyWJones
Thanks, do you know how I can represent this in XAML, as doing in code seems to mess with the VS designer.....
Dave Stringer