What is the best approach to binding commands in a ViewModel to elements in the View?

Posted by Micah on Stack Overflow See other posts from Stack Overflow or by Micah
Published on 2008-12-10T04:07:14Z Indexed on 2010/06/14 8:02 UTC
Read the original article Hit count: 325

Anyone who has tried to implement RoutedCommands in WPF using M-V-VM has undoubtedly run into issues. Commands (non-UI commands that is) should be implemented in the ViewModel. For instance if I needed to save a CustomerViewModel then I would implement that as a command directly on my CustomerViewModel. However if I wanted to pop up a window to show the users addresses I would implement a ShowCustomerAddress command directly in the view since this a UI specific function.

How do I define the command bindings in the viewmodel, and use them in the view?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about design-patterns