As I reviewed your code I noticed that you initialize the ColelctionViewSource in the following way:
patientsViewSource.Source = _context.PATIENTs.ToList();
This invokes a database call initializing patientsViewSource.Source with a collection of instances of the PATIENT class. Later on, you add a new item in the database through the Openaccess Context but not in the patientsViewSource.Source. This is the most probable reason why the page in not updated unless you reload it - patientsViewSource.Source = _context.PATIENTs.ToList(); is invoked again and the page binding is redone.
Possible approach to solving this problem would be to use ObservableCollection
adding all new items both in the database through the context and also in the observable collection. The DataGrid should be databound to the ObservableCollection. More information on the difference between CollectionViewSource and ObservableCollection could be found in this forum post
In order to take advantage of the same functionality that GridViewCollection provides, you could use the CollectionViewSource.GetDefaultView(ObservableCollection) method. For example:
ICollectionView itemsViewSource = CollectionViewSource.GetDefaultView(
Additionally, I would recommend to look through our Samples Kit
which provides a number of real-life examples including various scenarios with WPF application using the OpenAccess ORM and MVVM pattern.
Do not hesitate to contact us with any further questions.
OpenAccess ORM Q3 2013 simplifies your model operations even further providing you with greater flexibility. Check out the list of new features
shipped with our latest release!