I have a Lightswitch application that uses the scheduler is in a Silverlight user control.
The datasource is a Lightswitch screen based query that is passed in code as per the Telerik example Lightswitch Extension project here.
I am filtering the data on the visibledaterange of the scheduler because Lightswitch dies trying to pass a list of all 38,000 records in the appointments database (as in this
On first activation of the screen the scheduler works fine. On changing visibledaterange it disappears. I can step through the code below and it all seems to work. But when focus returns to the screen, the scheduler appears as an empty grey box.
How do I refresh it?
Code behind the Lightswitch page to handle the filtering of the data so that the datasource is limited to visible appointments only:
Private Sub SAControl_ControlAvailable(ByVal sender As Object, ByVal e As ControlAvailableEventArgs)
rsvc = TryCast(e.Control, MyScheduleView)
AddHandler CType(rsvc, MyScheduleView).VisibleRangeChanged, AddressOf Schedule_RangeChanged
Private Sub Schedule_RangeChanged()
Me.StartDate = CType(rsvc, MyScheduleView).VisibleRangeStart 'optional parameter of DataAppointments query
Me.EndDate = CType(rsvc, MyScheduleView).VisibleRangeFinish 'optional parameter of DataAppointments query
This code runs behind the Silverlight user control:
Public Sub GetLSAppointments(ByVal myAppointments As List(Of DataAppointment))
For Each scheduledAppointment As DataAppointment In myAppointments
Dim appt As AppointmentConsult = MakeAppointment(scheduledAppointment)
xScheduleView.AppointmentsSource = Nothing
xScheduleView.AppointmentsSource = _coreAppointments