Windows Presentation Foundation (WPF) provides RoutedCommand, which is good at connecting command invokers, such as menu items and buttons, with command handlers that are associated with the current item in the visual tree that has keyboard focus. However, in a composite scenario, the command handler is often a view model that does not have any associated elements in the visual tree or is not the focused element. To support this scenario, the Prism Library provides DelegateCommand, which allows you to call a delegate method when the command is executed, and CompositeCommand, which allows you to combine multiple commands. These commands are different from the built-in RoutedCommand, which will route command execution and handling up and down the visual tree. This allows you to trigger a command at a point in the visual tree and handle it at a higher level. Below you will find some resources that complement the information about this subject on the corresponding chapter in the Prism MSDN documentation.

  • Command inside DataTemplate
    • Version: 4.0
    • Description: A thread that explores the possibilities for binding to a Command in a ViewModel from within a DataTemplate
  • EventAggregator or Command
    • Version: 4.0
    • Description: In this thread there is an explanation about when it's useful to use EventAggregation and when it's useful to use Commanding.

Last edited May 13, 2011 at 8:33 PM by GuidoMaliandi, version 13


No comments yet.