How to make a Windows Phone 8.1 TimePicker inherit from the system regional format?

97 views Asked by At

When I add a TimePicker control to a Windows Phone 8.1 application, it uses the 12-hour format instead of the regional format configured at the OS level (Settings > Region > Regional Format).

I know I can force the format manually by setting the ClockIdentifier property but I'm looking for a more elegant/global solution that uses the system settings and configures all my controls at once.

If it must be done manually, how to retrieve the system time format?

1

There are 1 answers

0
SteveFerg On

One option to try is

private void SetCaptions()
{
    System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
    this.SuspendLayout();
    for (int i = 0; i != Controls.Count; i++)
    {
        resources.ApplyResources(Controls[i], Controls[i].Name, Program.Culture);
    }
    resources.ApplyResources(this, "$this", Program.Culture);
    this.ResumeLayout(false);
}

(see: http://www.codeproject.com/Articles/25392/Windows-Mobile-Globalization-in-Visual-Studio)

and there is System.Globalization.CultureInfo.CurrentCulture and System.Globalization.CultureInfo.CurrentUICulturethat can be set programmatically.