Intersoft ClientUI Documentation
RoutedCommand Class
Members  See Also  Send Feedback
Intersoft.Client.Framework.Input Namespace : RoutedCommand Class






Defines a command that implements ICommand and is routed through the element tree.

Object Model

RoutedCommand Class

Syntax

Visual Basic (Declaration) 
<TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")>
Public Class RoutedCommand 
Visual Basic (Usage)Copy Code
Dim instance As RoutedCommand
C# 
[TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")]
public class RoutedCommand 
Delphi 
public class RoutedCommand 
JScript 
TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")
public class RoutedCommand 
Managed Extensions for C++ 
[TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")]
public __gc class RoutedCommand 
C++/CLI 
[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 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2012 All Rights Reserved.