Is there a TimePicker control in WPF (.NET 4)?

B. Clay Shannon picture B. Clay Shannon · Feb 9, 2012 · Viewed 83k times · Source

Is there a TimePicker control in WPF (.NET 4)?

I was hoping the DatePicker control had the ability to show either a data or a time or both, but it doesn't seem so. Either of these would fit the bill for me:

Wednesday, February 8th, 2012 2:27 pm

-or:

2:27 pm

(which I would use in conjunction with a DatePicker)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Updated (after trying to install the extended WPF controls):

So much for that / that is not as easy it sounds/should be.

When I tried to download the extended WPF Toolkit from http://wpftoolkit.codeplex.com/releases/view/71499 I got in my download dialog:

http://download.codeplex.com/site/pagenotfound?ReferenceId=f1704e1d-3152-4ecf-b2bb-ace62735bcbc

(note the "page not found" part - nothing downloaded).

...so then I proceeded to plan B and tried to download/install Nuget, so I could get the extended WPF Toolkit that way (via Tools | Extension Manager | Online Gallery | Updates (1) | NeGet Package Manager | Download).

I first had to uncheck the box saying "protect me from potentially malicious code" (or something to that effect - I'd tried it (twice!) without unchecking that checkbox, and it crashed both times); and then (after unchecking the box) I saw in the install dialog, "This extension contains a digital signature with an invalid certificate."

I continued anyway, and finally got Nuget installed.

So after restarting Visual Studio 2010 I went to Tools | Library Package Manager | Package Manager Console, but was greeted with the Error: The Package Manager Console requires PowerShell 2.0 runtime, which is not detected on this machine. Please install the PowerShell 2.0 from http://support.microsoft.com/kb/968929 and restart Visual Studio.rt Visual Studio."

Then, when I went to install that update (WindowsXP-KB968930-x86-ENG.exe), I got, "The update/update.exe application cannot be run in Win32 mode." and it failed to proceed.

Achhh!!! It feels like a Monday!

Answer

d_schnell picture d_schnell · Feb 9, 2012

WPF 4.0 doesn't provide a DateTimePicker out of the box.

Updated I'm used the Extended WPF Toolkit http://wpftoolkit.codeplex.com/ in an recent project it includes a nice DateTimePicker Control - http://wpftoolkit.codeplex.com/wikipage?title=DateTimePicker&referringTitle=Home.

Sorry for this inaccuracy.