Welcome to Windows Presentation Foundation (WPF)
Top Tasks :

WPF Community Bloggers

Great new way for using RoutedCommands with the ViewModel pattern in WPF

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...
Published Friday, July 25, 2008 4:17 AM by Ruurd Boeke Enterprise development and technobabble - WPF (Avalon)
Filed under:

Comments

No Comments
Anonymous comments are disabled

Copyright © 2006 Microsoft Corporation. All Rights Reserved. | Terms of Use | Privacy Statement | Contact Us