Using Custom Regional Settings in WPF


  • I am creating a localized WPF application and i want WPF to use whatever settings i have in my regional settings.

    All over the internet they recommend the following code, which i did use

    protected override void OnStartup(StartupEventArgs e)
        new FrameworkPropertyMetadata(

    Now, let's suppose that in the regional settings i'm still using en-US but i have decided to show the currency as 1 digit after the decimal point instead of 2

    If i use this code, it works perfectly

    decimal d = 2.5M;

    but when i use binding, i still get both digits after the decimal point

    <TextBlock Text="{Binding Net, StringFormat=c}"/>

    Now if i change the locale to fr-FR, the currency symbol changes in both ToString and WPF binding, which proves that the code i added on the StartUp is working. Without this code the binding will not take the selected locale in the regional settings into consideration.

    It looks like the code that we are using in the StartUp event loads the default settings of selected language in the regional settings, so any modifications that i make after selecting the language will not be taken into consideration in WPF binding.

    Am i missing something, or this is a bug in WPF localization?


    Thank you for any Feedback


    Friday, October 8, 2010 10:47 PM

All replies

  • Hi Fadi,

    I have discussed this issue here:

    If you introduce ConverterCulture in your binding, it should fix this.

    This issue is also reported here:


    Saturday, October 9, 2010 1:48 AM
  • Dear Muhammad,


    Thanks for your reply.

    It looks like that you have misunderstood my point. I can get the currency in my binding to be to be localized, but i don't want the default localization.

    For example in the regional settings if you change to fr-FR, you will get the Euro symbol and 2 digits after the decimal point. In my case i just want 1 digit after the decimal point. so i go to the regional settings and change that. The ToString("C") gets affected, but the binding doesn't.

    The bug that you have mentioned is just about adding the code on StartUp, and the ConverterCulture is not practical anyway because i can't put a text block for all cultures.




    Saturday, October 9, 2010 9:35 AM