I need to bind my scheduler to devexpress xpo in WPF the problem is I don't know how to use XPCollection in this case..
1- I used the wizard to automatically generate a data model from the database
2- I have a scheduler with mappings in XAML
3- In code-behind, this is what I used and I think the problem is here
public MainWindow()
{
InitializeComponent();
XPCollection Appointmentcollection = new XPCollection(typeof(MedicalAppointments));
scheduler.DataSource.AppointmentsSource = Appointmentcollection;
XPCollection Doctorscollection = new XPCollection(typeof(Doctors));
scheduler.DataSource.ResourcesSource = Doctorscollection;
}
In Debug, whenever I try to add an appointment by double-clicking a field in scheduler control or by using the ribbon I get an error:
System.NullReferenceException: 'Object reference not set to an instance of an object.'
How can I fix this and what is the best way ti initiate an XPCollection In Code?
What I have tried:
public MainWindow()
{
InitializeComponent();
XPCollection Appointmentcollection = new XPCollection(typeof(MedicalAppointments));
scheduler.DataSource.AppointmentsSource = Appointmentcollection;
XPCollection Doctorscollection = new XPCollection(typeof(Doctors));
scheduler.DataSource.ResourcesSource = Doctorscollection;
}