Per-day ClockItemsSource??

2 posts, 0 answers
  1. Thomas
    Thomas avatar
    6 posts
    Member since:
    Jan 2012

    Posted 03 Feb 2012 Link to this post


    I'd like to make a DateTimePicker where the available time-of-day values depend on the day chosen.

    I was thinking I could just bind the ClockItemsSource to an ObservableCollection, and then change the contents of the collection depending on the day chosen.

    Here's my simplified XAML:
    <UserControl ...>
       <NIBControls:VoyagePicker x:Name="DateTimePicker"/>

    And the code-behind looks like this:
    public partial class VoyagePicker : UserControl
       public VoyagePicker()
          DateTimepicker.ClockItemsSource = m_selectedDayVoyageTimes;
          m_selectedDayVoyageTimes.Add(new TimeSpan(10, 11, 12));
          DateTimepicker.SelectionChanged += DateTimepicker_SelectionChanged;
       private readonly ObservableCollection<TimeSpan> m_selectedDayVoyageTimes =
          new ObservableCollection<TimeSpan>();
       void DateTimepicker_SelectionChanged(object sender, SelectionChangedEventArgs e)
          this.m_selectedDayVoyageTimes.Add(new TimeSpan(14, 15, 16));

    The problem is that the time-of-day values displayed never change - it is as if the time picker ignores the ObservableCollection change events!

    Can anyone tell me what I'm doing wrong - or if there's a way to force the time picker to update itself?

    We're approaching a deadline, and I'm really stuck here - any help would be greaty appreciated!

  2. Boyan
    Boyan avatar
    758 posts

    Posted 06 Feb 2012 Link to this post


    I have answered your question in your other thread but will paste it here so others may see it.

    We managed to reproduce the bad behavior. The RadDateTimePicker ClockItemsSource is changed but the layout is not updated. This is a bug in our control. I have logged the issue in our PITS and you can follow its progress here.

    We will try to fix this ASAP in order for it to be included in Q1 which is due in the next few weeks.

    Please, excuse us for the inconvenience. We have added points to your account for the report. Don't hesitate to contact us if you have other questions.

    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
Back to Top