This project has moved and is read-only. For the latest updates, please go here.

Set minimum date and time spinner steps

Mar 18, 2016 at 8:54 PM
How can I:
  • Set the current date+time as the minimum "selectable" date in the calendar?
  • Is it possible to set the Time spinner to increase in steps of 5 minutes instead of 1 minute?
  • Automatically show the current date as default?
Thank you for the help!
Developer
Mar 22, 2016 at 3:23 PM
Hi,

I believe you are talking about the Control DateTimePicker.

You can try this :
<xctk:DateTimePicker  Value="{Binding ., Source={x:Static sys:DateTime.Now}}"
                           Minimum="{Binding ., Source={x:Static sys:DateTime.Now}}"
                           DefaultValue="{Binding ., Source={x:Static sys:DateTime.Now}}"/>
This will set the current date+time as the minimum "selectable" date in the calendar and Automatically show the current date as default.
For the Time spinner to increase in steps of 5 minutes instead of 1 minute,
-starting at v2.9, you have access to DateTimePicker.Step property which increment/decrement the selected Date part by this Step value.
-starting a v3.1 the TimePicker.Step property is binded to the DateTimePicker.Step property. But again, this TimePicker.Step property will increment/decrement the selected time part by this Step value. So setting it to 5, will increment/decrement hours by 5 and minutes by 5.
Issue https://wpftoolkit.codeplex.com/workitem/22219 has been created to set a Step per Time part.
Mar 24, 2016 at 8:01 PM
Thank you for the reply, the code you suggested worked nicely!

Congratulations for the great work!