Access objects in button event handler
- by developer
How to access list of observable collection objects that I create in my constructor to bind to the UI, in the Save button event handler.
I have created a observable collection of objects in my constructor and then I bind that in the UI. Now how will I access those objects, as I want to save them in the database.
I tried doing
ProgramViewModel newtest = DataContext as ProgramViewModel;
But newtest is always null. Though I can see the data in when I hover my mouse over DataContext while debugging..