Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7738581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:18:12+00:00 2026-06-01T08:18:12+00:00

In a small Wpf application, use a DatePicker bound to a DateTime property. When

  • 0

In a small Wpf application, use a DatePicker bound to a DateTime property.
When the user’s region and language settings, and number and date format are German, the date is displayed in German, and the calendar shows German month names.
Now I wanted to get it in US-English. In the c’tor of MainWindow I added before InitializeComponent() (same situation when doing that after InitializeComponent()):

string uiLanguage = ConfigurationManager.AppSettings["UILanguage"]; //"en-US"
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(uiLanguage);
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(uiLanguage)));

While that works with textboxes, it has no effect with the DatePicker.
Then I was cheaky and created a new user “John English”, logged in as “John English”, set his display language to English and the date and number format to US-English. Now the DatePicker always displays the date in the US-English format and the calendar shows English month names, even when I set the language of my program to German.
How can that be resolved? Can it be resolved at all?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:18:14+00:00Added an answer on June 1, 2026 at 8:18 am

    In the codebehind of the App.xaml add the following code:

    public App()
    {
        EventManager.RegisterClassHandler(typeof(DatePicker), DatePicker.LoadedEvent, new RoutedEventHandler(DatePicker_Loaded));
    }
    
    void DatePicker_Loaded(object sender, RoutedEventArgs e)
    {
        var dp = sender as DatePicker;
        if (dp == null) return;
    
        var tb = GetChildOfType<DatePickerTextBox>(dp);
        if (tb == null) return;
    
        var wm = tb.Template.FindName("PART_Watermark", tb) as ContentControl;
        if (wm == null) return;
    
        wm.Content = "[Put your text here]";
    }
    

    [Ontopic ;)]
    Try setting both CurrentCulture and CurrentUICulture.

    //Set default culture to Nl
    System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
    System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
    

    ref for GetChildOfType

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a small WPF application. For the layout in the application, i use
I created a small WPF desktop application. I am thinking about how to make
I have a fairly small solution that includes a WPF windows application. It builds
I'm working on writing a small application using the WPF MediaKit , and I
I have a small WPF application based on MVVM priniciples. So far I had
I've got a WPF application which starts off with a very small window. Something
I am writing a small application in WPF. It allows me to save and
I have a small Java Swing application that I want to rewrite in WPF
I have a small-scale WPF application using VB.net as the code behind and I
I have a wpf application (I use CAL) for a tablet pc. I created

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.