Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set 24-hour time format for TimePicker

I'm building an MVVM Light WPF app in Visual Studio 2015 using the Material Design in XAML Toolkit. Here's the TimePicker control:

<materialDesign:TimePicker Is24Hours="True" />

Here's what the control looks like when you click it:

TimePicker open

Note that it shows the time in 24-hour format correctly. However, when you select that time and return to the field, it displays it as non-24-hour time, with AM/PM:

TimePicker closed

Is there any way to force the control to display the time in 24-hour format? Thanks.

like image 773
Alex Avatar asked Oct 15 '25 21:10

Alex


1 Answers

As of 1.5 you can't explicitly enforce it:

You can use SelectedTimeFormat (long/short) e.g.

<materialDesign:TimePicker Is24Hours="True" SelectedTimeFormat="Long" />

But, this picks up the Windows regional setting short/long formats, so it depends on the local PC.

I guess I can add an override for a future release...

like image 172
James Willock Avatar answered Oct 17 '25 12:10

James Willock