Access objects in button event handler

Posted by developer on Stack Overflow See other posts from Stack Overflow or by developer
Published on 2010-04-28T21:56:29Z Indexed on 2010/04/28 22:07 UTC
Read the original article Hit count: 321

Filed under:
|

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..

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf