How to pick only Time from DateTimePicker

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 11 years ago by Raghuraj
Version: 4.5.0477
Avatar
I need to use datetime picker for entering time only not the date .

I added the datetime picker as follows:

<shared:DateTimePicker Margin="0,10,0,0" MinWidth="90" HorizontalAlignment="Left" Value="{x:Static system:DateTime.Now}" ValueConverter="{x:Null}" Height="25">

<shared:DateTimePicker.ValueConverterParameter>
<shared:DateTimeToStringPattern>ShortTime</shared:DateTimeToStringPattern>

</shared:DateTimePicker.ValueConverterParameter>

</shared:DateTimePicker>


It is showing following build error.

Unknown build error, 'Key cannot be null.Parameter name: key

But when I removed the Value="{x:Static system:DateTime.Now}", then it is not giving the error but. The dtpicker is showing dropdown to select the date. Which I don’t require I only interested in showing the Time and allowing the user to enter time in AM/PM format.


Regards

Raghuraj

Comments (5)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Raghuraj,

You probably didn't define the "system" namespace in your XAML root tag. Look in our DateTimePicker samples for "xmlns:system=" and I believe there is an example in there of how to define it.


Actipro Software Support

Posted 11 years ago by Raghuraj
Avatar
Hi,

Thanks for the reply.

My next problem is that, I just want to show or take only TIME to/from user, it should not show the drop down list for date also.

As in the windows Date Time Properties window used for TIME.

How can i achieve this.


Thanks

Raghuraj
Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Raghuraj,

At this point you'd probably have to retemplate the control. If you are a customer, we can send you the default templates.

However we are working on a new Editors for WPF product now that will contain a more advanced version of the DateTimePicker. And perhaps for that, we'll look into adding some sort of clock to the drop-down when in time mode.


Actipro Software Support

Posted 10 years ago by Bill Boland - Software Engineer, CME, Inc for Thomson Elite
Avatar
I am also in need of the ability to enter the time portion for a date/time as part of the Drop Down of the DateTimePicker. I am converting an application from Delphi using DevExpress VCL components to that included a Date editor that provides a clock and time spinner in the drop down when the component supports date and time entry. This is especially important for appointments and allows the user to entry both date and time in the same drop down interface.

The prior comment from support (11-months ago) indicated that a clock may be added. Is this still being looked into? If so, any ETA? If not, the customer I am working with has purchased a source license. Is it possible to easily modify the existing DateTimePicker to add such behavior? Any thoughts, guidance of suggestions would be welcome.

Thanks.

bill boland
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bill,

It is still something on our TODO list. We've been talking offline with Daniel from your group about options towards getting it implemented faster.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.