RadDateTimePicker programmatically change Time scales

2 posts, 0 answers
  1. JIG
    JIG avatar
    78 posts
    Member since:
    Sep 2009

    Posted 03 Nov 2016 Link to this post


    Is it possible when using the standard DateTimePicker to dynamically change the StartTime/EndTime properties of the Time-part of the control?

    I would like the user to be able to click f.ex. 9:00 in the TimePicker, after which this same Time-picker part displays 9:05, 9:10, 9:15, 9:20... until 10:00

    (a bit the same like for the Date-picker part - where you can choose the year, then month, then date ....)

    Is that something that can be done?


  2. Stefan Nenchev
    Stefan Nenchev avatar
    665 posts

    Posted 07 Nov 2016 Link to this post


    You can consider utilizing the SelectionChanged event of the RadDateTimePicker control and manually add set the StartTime and EndTime properties according to the selected hour:

    private void RadDateTimePicker_SelectionChanged(object sender, SelectionChangedEventArgs e)
              var selectedHour = ((DateTime)e.AddedItems[0]).Hour;
              this.RadDateTimePicker.StartTime = new TimeSpan(selectedHour,0,0);
              this.RadDateTimePicker.TimeInterval = new TimeSpan(0, 5, 0);
              this.RadDateTimePicker.EndTime = new TimeSpan(selectedHour + 1, 0, 0);

     Of course, you might need to further consider the exact approach according to your setup. I suggest you have a look at the following article from our documentation - Clock Items - as setting a custom ClockItemsSource should be useful for you.

    Stefan Nenchev
    Telerik by Progress
    Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
Back to Top