Intersoft ClientUI Documentation
RoutedCommand Class
Members 



Defines a command that implements ICommand and is routed through the element tree.
Object Model
RoutedCommand ClassInputGestureCollection ClassInputGesture Class
Syntax
<TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")>
Public Class RoutedCommand 
Dim instance As RoutedCommand
[TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")]
public class RoutedCommand 
[TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")]
public ref class RoutedCommand 
Remarks

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.

The Execute method raises the PreviewExecuted and Executed events. The CanExecute method raises the PreviewCanExecute and CanExecute events.

The following code example shows the event handler for the CanExecute and Executed routed event for the CommandBinding which is associated to a routed command.

C#
Copy Code
private void CutCmdCanExecute(object sender, CanExecuteRoutedEventArgs e)
{
     e.CanExecute = true;
}
private void CutExecuted(object sender, ExecutedRoutedEventArgs e)
{
     string command = ((RoutedCommand)e.Command).Name;
     string target = ((FrameworkElement)e.OriginalSource).Name;

     MessageBox.Show("The " + command +  " command has been invoked on target object " + target);
}

For a more complete version of the above example, see How-to: Implement a RoutedCommand. For more information on commanding, see Commanding Overview.

Inheritance Hierarchy

System.Object
   Intersoft.Client.Framework.Input.RoutedCommand
      Intersoft.Client.Framework.Input.RoutedUICommand

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

RoutedCommand Members
Intersoft.Client.Framework.Input Namespace

Send Feedback