Appointment Source Binding Issue

2 posts, 0 answers
  1. Barry
    Barry avatar
    90 posts
    Member since:
    Jul 2011

    Posted 12 Jul 2011 Link to this post

    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?

  2. Barry
    Barry avatar
    90 posts
    Member since:
    Jul 2011

    Posted 12 Jul 2011 Link to this post

    For some reason I imported the Scheduler instead of the scheduleview, so I was using the wrong Appointment class...
  3. DevCraft banner
Back to Top