Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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;  
        }
Posted
Updated 8-Sep-19 21:11pm
v2

1 solution

Maybe you can use this scheduler control, at least you will have access to the source code:
Creating an Outlook Calendar using WPF (Part 1)[^]
 
Share this answer
 
Comments
izz moe 9-Sep-19 6:55am    
I'm actually learning Devexpress controls
RickZeeland 9-Sep-19 8:00am    
Can't be of help with that sadly, as we are using NHibernate ORM (brrrrr)
izz moe 9-Sep-19 12:28pm    
thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900