This is a migrated thread and some comments may be shown as answers.

Per-day ClockItemsSource??

1 Answer 58 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Thomas
Top achievements
Rank 1
Thomas asked on 03 Feb 2012, 09:00 AM
Hi,

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"/>
</UserControl>

And the code-behind looks like this:
public partial class VoyagePicker : UserControl
{
   public VoyagePicker()
   {
      InitializeComponent();
 
      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!


1 Answer, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 06 Feb 2012, 01:52 PM
Hello,

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.



Regards,
Boyan
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
DateTimePicker
Asked by
Thomas
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Share this question
or