WPF - Handling events from user control in View Model

Posted by Vitaly on Stack Overflow See other posts from Stack Overflow or by Vitaly
Published on 2010-05-28T06:56:50Z Indexed on 2010/05/28 7:01 UTC
Read the original article Hit count: 290

Filed under:
|
|

I’m building a WPF application using MVVM pattern (both are new technologies for me). I use user controls for simple bits of reusable functionality that doesn’t contain business logic, and MVVM pattern to build application logic. Suppose a view contains my user control that fires events, and I want to add an event handler to that event. That event handler should be in the view model of the view, because it contains business logic. The question is – view and the view model are connected only by binding; how do I connect an event handler using binding? Is it even possible (I suspect not)? If not – how should I handle events from a control in the view model? Maybe I should use commands or INotifyPropertyChanged?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about events