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:
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:
Is there any way to force the control to display the time in 24-hour format? Thanks.
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...
来源:https://stackoverflow.com/questions/37141002/set-24-hour-time-format-for-timepicker