
Visual Basic (Declaration) | |
---|---|
Public NotInheritable Class CanQueryStatusRoutedEventArgs Inherits Intersoft.Client.Framework.ISRoutedEventArgs |
Visual Basic (Usage) | ![]() |
---|---|
Dim instance As CanQueryStatusRoutedEventArgs |
C# | |
---|---|
public sealed class CanQueryStatusRoutedEventArgs : Intersoft.Client.Framework.ISRoutedEventArgs |
Delphi | |
---|---|
public class CanQueryStatusRoutedEventArgs = class(Intersoft.Client.Framework.ISRoutedEventArgs)sealed; |
JScript | |
---|---|
public sealed class CanQueryStatusRoutedEventArgs extends Intersoft.Client.Framework.ISRoutedEventArgs |
Managed Extensions for C++ | |
---|---|
public __gc __sealed class CanQueryStatusRoutedEventArgs : public Intersoft.Client.Framework.ISRoutedEventArgs |
C++/CLI | |
---|---|
public ref class CanQueryStatusRoutedEventArgs sealed : public Intersoft.Client.Framework.ISRoutedEventArgs |
HybridCommandManager exposes CanQueryStatus routed event to provide a mechanism to determine whether a command can query the status of its command target. The instance CanQueryStatus event is also available in the HybridCommandBinding class. The CanQueryStatus routed event sent a CanQueryStatusEventArgs as the event data when the routed event is raised.
The event data in CanQueryStatusEventArgs contains three main properties:
- The Command is the action to be executed.
- The CanQueryStatus is assigned by the logic that determines whether QueryStatus is allowed on the command.
- The QueryParameter is the custom data that contains the status parameter in the form of QueryStatusParameter to be sent to the command sources that associated to the command.
When a command is determined to support query status, you set the value of the CanQueryStatus property in the event data to true. The QueryStatus event will be raised according to the value of the CanQueryStatus property.
The following code example shows the event handler for CanQueryStatus and QueryStatus routed event for the HybridCommandBinding associated to the Bold command.
C# | ![]() |
---|---|
private void BoldCmdCanQueryStatus(object sender, CanQueryStatusRoutedEventArgs e) { e.CanQueryStatus = true; } private void BoldCmdQueryStatus(object sender, QueryStatusRoutedEventArgs e) { if (e.Command == EditingCommands.Bold) { // notifies the current bold status to the command source // that bound to the Bold command. e.QueryParameter.Value = (FontWeight)textBox1.Selection. GetPropertyValue(Run.FontWeightProperty) == FontWeights.Bold; } } |
For a complete example of how to implement a hybrid routed command, see How-to: Implement a HybridRoutedCommand.
For more information about hybrid command concept, see Hybrid Commands.
Intersoft.Client.Framework.ISRoutedEventArgs
Intersoft.Client.Framework.Input.CanQueryStatusRoutedEventArgs
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