Defining Events for use in MVVM


  • I found this passage in Programming Windows 6th Edition by Charles Petzold:

    "View -> View Model -> Model. Calls in the other direction are not allowed except for events. The Model can define an event that the View Model handles, and the View Model can define an event that the View handles. Events allow the View Model (for example) to signal to the View that updated data is available. The View can then call into the View Model to obtain that updated data."

    I am having trouble finding resources that describe how to define an event. Basically I want the code in my ViewModel to be able to programmatically trigger an event that is then handled in my View. Is it possible to define and handle your own events? If so, could someone please point me towards some helpful documentation or a sample?

    Thanks so much!

    Thursday, July 19, 2012 12:35 AM


All replies