Intersoft.Client.Framework.Input Namespace : RoutedUICommand Class |
<TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")> Public Class RoutedUICommand Inherits RoutedCommand
Dim instance As RoutedUICommand
[TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")] public class RoutedUICommand : RoutedCommand
[TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")] public ref class RoutedUICommand : public RoutedCommand
The difference between a RoutedUICommand and RoutedCommand is that RoutedUICommand includes a Text property.
The Execute and CanExecute methods on a RoutedCommand do not contain the command logic for the command, as is the case with a typical ICommand. 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.
System.Object
Intersoft.Client.Framework.Input.RoutedCommand
Intersoft.Client.Framework.Input.RoutedUICommand
Intersoft.Client.Framework.Input.HybridRoutedCommand
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