Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As you have noticed the <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.routedcommand.aspx" rel="noreferrer"><code>RoutedCommand</code> class</a> is an implementation of the <code>ICommand</code> interface, its main distinction if that its function is similar to that of a <code>RoutedEvent</code>:</p> <blockquote> <p>The Execute and CanExecute methods on a RoutedCommand do not contain the application logic for the command as is the case with a typical ICommand, but rather, these methods raise events that traverse the element tree looking for an object with a CommandBinding. The event handlers attached to the CommandBinding contain the command logic.</p> <p>The Execute method raises the PreviewExecuted and Executed events. The CanExecute method raises the PreviewCanExecute and CanExecute events.</p> </blockquote> <p>In a case when you don't want the behavior of the <code>RoutedCommand</code> you'll be looking at your own implementation of <code>ICommand</code>. As for the MVVM pattern I can't say that one solution, it seems that everyone has their own methodology. However, here are a few approaches to this problem that I've come across:</p> <ul> <li><a href="http://www.codeproject.com/KB/WPF/VMCommanding.aspx" rel="noreferrer">Using RoutedCommands with a ViewModel in WPF</a></li> <li><a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx#id0090030" rel="noreferrer">Relaying Command Logic</a></li> <li><a href="http://marlongrech.wordpress.com/2008/11/26/avoiding-commandbinding-in-the-xaml-code-behind-files/" rel="noreferrer">Simple Command</a> (almost identical to Relay Command but worth reading)</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload