ICommandExtension.QueryStatus Method

Implement this to define whether your command should be visible and enabled. Set command.Visible and command.Enabled. Do not change the state of the model.

Namespace:  Microsoft.VisualStudio.Modeling.ExtensionEnablement
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.10.0.dll)


Sub QueryStatus ( _
    command As IMenuCommand _
void QueryStatus(
    IMenuCommand command
void QueryStatus(
    IMenuCommand^ command
abstract QueryStatus : 
        command:IMenuCommand -> unit 
function QueryStatus(
    command : IMenuCommand



Declare an imported property Context in order to access the diagram and model:

public IDiagramContext Context { get; set; }
public void Execute (IMenuCommand command)
  command.Enabled = command.Visible =
          .GetSelectedShapes<IClassifier>().Count() > 2;

For more information, see How to: Define a Menu Command on a Modeling Diagram.

.NET Framework Security

See Also


ICommandExtension Interface

Microsoft.VisualStudio.Modeling.ExtensionEnablement Namespace