Josh Smith just published a great article about his solution to using RoutedCommands in WPF. The problem he solves, has been solved by others before, however, I think this is a very lightweight succinct way of doing it. Basically, when you set a command to a button, you will have to handle that logic (canExecute and Execute) in the codebehind of the view. Since you are (hopefully) using a MVC, MVP or MVVM approach, you would rather not go through the codebehind of the view, but directly route the commands to the appropriate viewmodel/controller. He creates a relaying object that does just that. This results in a completely empty codebehind for the view, which is exactly what I like! Good job Josh!
Read More...