4

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?

R. Martinho Fernandes
  • 228,013
  • 71
  • 433
  • 510
Micah
  • 111,873
  • 86
  • 233
  • 325
  • I arrived to the same solution... and I also wrote a blog entry about it :) You can find it [here](http://blog.notifychanged.com/2008/07/28/defining-commandbindings-in-the-viewmodel). – DaniCE Jan 22 '09 at 00:16

1 Answers1

2

Here is a solution that I came up with.

Micah
  • 111,873
  • 86
  • 233
  • 325