Hello - I have encountered a somewhat similar casting error when adding a custom field Email.
Unable to cast object of type 'Telerik.WinControls.UI.Appointment' to type 'RegWinRadScheduleBizObj.AppointmentWithEmail' in protected override void LoadSettingsFromEvent(Telerik.WinControls.UI.IEvent sourceEvent) My situation is slightly different in that I want to do away from creating dataset via .xds. I am trying to connect to biz object following this tutorial video starting at at https://youtu.be/RHgMwE2vlsc?t=30m40s
I've got all 3 classes MyAppointment.cs, MyPrepository.cs, and MyResouce.cs implemented per instructions and the appointments show up graphically on the schedule, apparently the mapping went well. However when trying get the 'inherit' AppointmentWithEmailEditForm to load (with additional Email field) that casting error pops up.
As far as inheritance, the implements are:
public class MyAppointment : INotifyPropertyChanged
public class AppointmentWithEmail : AppointmentWithEmail : Appointment
These blocks coming from the DataSet connection tutorial though
if I then do AppointmentWithEmail : MyAppointment, I will get Cannot implicitly convert type 'RegWinRadScheduleBizObj.BizModels.AppointmentWithEmail' to 'Telerik.WinControls.UI.IEvent' in the factory class
public class AppointmentWithEmailFactory : IAppointmentFactory
{ public IEvent CreateNewAppointment()
{
return new AppointmentWithEmail();
}
}
So creating the factory (1 of the 5 steps in the video) only applies for the SchedulerDataSet.xds scenario? Right now kind of confused, can you help me with the explicit conversion if the factory needed?
private void radScheduler1_AppointmentEditDialogShowing(object sender, AppointmentEditDialogShowingEventArgs e) { if (appointmentDiaglog == null)
appointmentDiaglog = new AppointmentWithEmailEditForm();
e.AppointmentEditDialog = appointmentDiaglog; }
protected override void LoadSettingsFromEvent(Telerik.WinControls.UI.IEvent sourceEvent)
{ base.LoadSettingsFromEvent(sourceEvent);
var appointmentWithEmail = (AppointmentWithEmail)sourceEvent;
if (appointmentWithEmail.Email != null)
txtEmail.Text = appointmentWithEmail.Email;
}
protected override void ApplySettingsToEvent(Telerik.WinControls.UI.IEvent targetEvent)
{ var appointmentWithEmail = (AppointmentWithEmail)targetEvent; (error poped up here)
if (appointmentWithEmail.Email != null)
appointmentWithEmail.Email = txtEmail.Text;
base.ApplySettingsToEvent(targetEvent);
}
What am I missing?
Thanks in advance.