I'm trying to learn how to use WPF commands, and how they fit into the MVVM pattern. I understand that some controls, like a button or menu, have a Command property which when set to an instance of an ICommand class connects the button to that command. Once this is set the button will then disable and enable with the CanExecuteChanged event of the command, and clicking the control will call the Execute method of the command.
However, where should the instance of each ICommand live? I've seen various different options in tutorials and I'm not sure which is correct. In some examples a static "ApplicationCommands" class is created and an instance of each command is assigned to a static property of that class. In other examples I've seen commands set as properties of the ViewModel, and in others of the View/Window itself. What's the preferred place for the command instances to live?
Also, how does a command relate back to the View, View Model, or Model? Which of these components should the command be aware of and or manipulate? What should happen when a command is executed? Should it call some method of the Model which then communicates changes back to the View Model/View? Or should a command communicate to the model through a method of the View Model?