Mubeen Ali
Mubeen Ali

Reputation: 65

Set AM/PM in Material Time Picker WPF

I'm building a simple WPF app in VS 15 .NET 4.5 and in need of Time Picker. i used Material Design

<materialDesign:TimePicker Grid.Row="1" Grid.Column="2" Is24Hours="False" x:Name="tPicker" HorizontalAlignment="Stretch" Margin="0 0 0 10" materialDesign:HintAssist.Hint="Pick Time"  />

Screen

i'm getting only the time. there were no AM/PM

Upvotes: 0

Views: 1423

Answers (1)

mm8
mm8

Reputation: 169320

If you want to show AM/PM next to the time, you will either have to change your computer's regional settings in the Control Panel:

enter image description here

Or you could set the CurrentCulture of the UI thread:

public MainWindow()
{
    System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
    InitializeComponent();
}

I am afraid you can't specify a custom format besides Long and Short:

Set 24-hour time format for TimePicker

Upvotes: 1

Related Questions