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

Appointment Source Binding Issue

1 Answer 144 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Barry
Top achievements
Rank 1
Barry asked on 12 Jul 2011, 04:59 PM
I'm getting this error when trying to bind the AppoinmentSource:

System.NullReferenceException was unhandled by user code
  Message=Object reference not set to an instance of an object.
  StackTrace:
       at Telerik.Windows.Controls.ScheduleView.AppointmentExtensions.IsRecurring(IAppointment appointment)
       at Telerik.Windows.Controls.ScheduleView.AppointmentExtensions.GetOccurrences(IAppointment appointment, DateTime from, DateTime to)
       at Telerik.Windows.Controls.DateGroupDescription.GroupNameFromItem(Object item, Int32 level, CultureInfo culture)
       at MS.Internal.CollectionViewGroupRoot.AddToSubgroups(Object item, CollectionViewGroupInternal group, Int32 level, Boolean loading)
       at System.Windows.Data.ListCollectionView.PrepareGroups()
       at System.Windows.Data.ListCollectionView.RefreshOverride()
       at System.Windows.Data.CollectionView.Refresh()
       at System.Windows.Data.CollectionView.EndDefer()
       at System.Windows.Data.CollectionView.DeferHelper.Dispose()
       at Telerik.Windows.Controls.ScheduleView.ScheduleViewDataConnection.SetGroupingAndFiltering(IEnumerable`1 groupDescriptions, Predicate`1 filter)
       at Telerik.Windows.Controls.ScheduleViewBase.RegenerateGroupHeaders()
       at Telerik.Windows.Controls.ScheduleViewBase.OnAppointmentSourceChanged(IEnumerable oldValue, IEnumerable newValue)
       at Telerik.Windows.Controls.ScheduleViewBase.UpdateScheduleViewOnAppointmentSourceChanged(IEnumerable oldValue, IEnumerable newValue)
       at Telerik.Windows.Controls.ScheduleViewBase.OnAppointmentsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
       at Telerik.Windows.PropertyMetadata.<>c__DisplayClass1.<Create>b__0(DependencyObject d, DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
       at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
       at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
       at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
       at Telerik.Windows.Controls.ScheduleViewBase.set_AppointmentsSource(IEnumerable value)
       at Pars.Web.SilverLight.Calendar.MainPage.Service_GetTasksCompleted(Object sender, GetTasksCompletedEventArgs e)
       at Pars.Web.SilverLight.Calendar.TaskCalendarReference.TaskCalendarServiceClient.OnGetTasksCompleted(Object state)
  InnerException:

I set the AppointmentSource as follows:

Dim appts As New ObservableCollection(Of Appointment)
 
For Each t In tasks
   appts.Add(MakeAppt(t))
Next
 
RadScheduleView1.AppointmentsSource = appts
 
.....
 
Private Function MakeAppt(task As Task) As Appointment
 
   Dim a As New Appointment With
            {
                .Body = task.TaskNarrative,
                .Start = task.InitiatedDate,
                .End = task.CompletionDueDate,
                .Subject = task.TaskNarrative,
                .IsAllDayEvent = False
             }
 
Return (a)
 
End Function

What am I doing wrong?

1 Answer, 1 is accepted

Sort by
0
Barry
Top achievements
Rank 1
answered on 12 Jul 2011, 06:11 PM
For some reason I imported the Scheduler instead of the scheduleview, so I was using the wrong Appointment class...
Tags
ScheduleView
Asked by
Barry
Top achievements
Rank 1
Answers by
Barry
Top achievements
Rank 1
Share this question
or