Defines a command that implements IHybridCommand which passes CanQueryState and QueryStatus as delegated method.

Visual Basic (Declaration) | |
---|---|
Public Class HybridCommandBinding Inherits CommandBinding |
Visual Basic (Usage) | ![]() |
---|---|
Dim instance As HybridCommandBinding |
C# | |
---|---|
public class HybridCommandBinding : CommandBinding |
Delphi | |
---|---|
public class HybridCommandBinding = class(CommandBinding) |
JScript | |
---|---|
public class HybridCommandBinding extends CommandBinding |
Managed Extensions for C++ | |
---|---|
public __gc class HybridCommandBinding : public CommandBinding |
C++/CLI | |
---|---|
public ref class HybridCommandBinding : public CommandBinding |
ClientUI extends the routed command model further by introducing hybrid routed command, a more advanced routed command that supports two kind of state synchronization behavior. In addition to the IsEnabled handling, HybridRoutedCommand can automatically synchronize the Visibility property of the command sources based on the value of the CanExecute in the event data.
The HybridRoutedCommand introduces a more intuitive commanding pattern by adding status querying capability on the top of execute querying mechanism.
Hybrid routed command is built on the top of routed command model that supports the commanding semantics such as the command, the command source, the command target, and the command binding. In addition, hybrid routed command exposes its own classes and object model to support additional features which includes HybridRoutedCommand, HybridCommandManager and a HybridCommandBinding class.
The HybridRoutedCommand class is derived from RoutedUICommand, and extended with IHybridCommand interface which expose two members, CanQueryStatus and QueryStatus, which are explained later in this topic.
You can use HybridRoutedCommand in the same way as you would do in RoutedCommand. The following code example shows how to setup a tool bar button to execute a HybridRoutedCommand.
XAML | ![]() |
---|---|
<Grid x:Name="LayoutRoot"> <Intersoft:CommandManager.CommandBindings> <Intersoft:CommandBindingCollection> <Intersoft:CommandBinding Command="Commands:EditingCommands.Bold" CanExecute="BoldCmdCanExecute" Executed="BoldCmdExecuted"/> <Intersoft:HybridCommandBinding Command="Commands:EditingCommands.Bold" CanExecute="BoldCmdCanExecute" Executed="BoldCmdExecuted"/> </Intersoft:CommandBindingCollection> </Intersoft:CommandManager.CommandBindings> <Intersoft:DockPanel Name="dockPanel1" FillChildMode="Custom"> <Intersoft:UXToolBar Name="toolBar1" Intersoft:DockPanel.Dock="Top"> <Intersoft:UXToolGroup> <Intersoft:UXToolBarButton Name="btn_Bold" Command="Commands:EditingCommands.Bold" DisplayMode="Image" Icon="../Images/BoldHS.png" ToolTipService.ToolTip="Bold"/> <Intersoft:UXToolBarButton Name="btn_Italic" Command="Commands:EditingCommands.Italic" DisplayMode="Image" Icon="../Images/ItalicHS.png" ToolTipService.ToolTip="Italic"/> </Intersoft:UXToolGroup> </Intersoft:UXToolBar> <Intersoft:UXTextBox Name="textBox1" Text="Type your text here..." Intersoft:DockPanel.IsFillElement="True" /> </Intersoft:DockPanel> </Grid> |
As shown in the above example, the standard CommandBinding is required in addition to the HybridCommandBinding definition because the hybrid routed command is fundamentally built upon the routed command model.
The following code example shows the event handler for the CanExecute and Executed routed event for the CommandBinding associated to the Bold command.
C# | ![]() |
---|---|
private void BoldCmdCanExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = true; } private void BoldCmdExecuted(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); } |
A version of hybrid command that supports MVVM Pattern is also provided. Using HybridDelegateCommand, you can define the command in the view model and bind it to the view. For more information about using command with MVVM Pattern, see MVVM Pattern Overview.
For more information about hybrid commands, see Hybrid Commands.
Intersoft.Client.Framework.Input.CommandBinding
Intersoft.Client.Framework.Input.HybridCommandBinding
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