menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class KeyboardCommand - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class KeyboardCommand

    Specifies a command and a key gesture to define when the command should be executed.

    Inheritance
    System.Object
    DiagramObject
    KeyboardCommand
    Implements
    IDiagramObject
    System.ICloneable
    Inherited Members
    DiagramObject.Clone()
    DiagramObject.GetParent()
    DiagramObject.OnPropertyChanged(String, Object, Object, IDiagramObject)
    Namespace: Syncfusion.Blazor.Diagram
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class KeyboardCommand : DiagramObject, IDiagramObject, ICloneable
    Examples
    The below code example illustrates how to call a group command.
    private void OnGroup()
    {
        diagram.Group();
    }

    Constructors

    KeyboardCommand()

    Declaration
    public KeyboardCommand()

    Properties

    Gesture

    Specifies a combination of keys and key modifiers, on the recognition of which the command should be executed.

    Declaration
    public KeyGesture Gesture { get; set; }
    Property Value
    Type
    KeyGesture
    Examples
    <summary>
    Notifies when to execute the custom keyboard commands .
    </summary>
    <remarks>
    The following code illustrates how to create a custom command.
    </remarks>
    <example>
    <code lang="Razor">
    <![CDATA[
    <SfDiagramComponent @ref="@diagram" Height="600px" Nodes="@nodes">
    @* Initializing the custom commands*@
        <CommandManager Commands = "@command">
        </CommandManager>
    </SfDiagramComponent>
    @code
    {
        // Reference to the diagram
        SfDiagramComponent diagram;
        DiagramObjectCollection<KeyboardCommand> command = new DiagramObjectCollection<KeyboardCommand>()
        {
            new Command()
            {
                Name = "CustomGroup",
                Gesture = new KeyGesture() { Key = DiagramKeys.G,  Modifiers = ModifierKeys.Control }
            },
            new Command()
            {
                Name = "CustomUngroup",
                Gesture = new KeyGesture() { Key = DiagramKeys.U,  Modifiers = ModifierKeys.Control }
            },
        };
      }
    }

    Name

    Specifies the name of the command.

    Declaration
    public string Name { get; set; }
    Property Value
    Type
    System.String
    Examples
    <summary>
    Notifies when to execute the custom keyboard commands .
    </summary>
    <remarks>
    The following code illustrates how to create a custom command.
    </remarks>
    <example>
    <code lang="Razor">
    <![CDATA[
    <SfDiagramComponent @ref="@diagram" Height="600px" Nodes="@nodes">
    @* Initializing the custom commands*@
        <CommandManager Commands = "@command">
        </CommandManager>
    </SfDiagramComponent>
    @code
    {
        // Reference to the diagram
        SfDiagramComponent diagram;
        DiagramObjectCollection<KeyboardCommand> command = new DiagramObjectCollection<KeyboardCommand>()
        {
            new Command()
            {
                Name = "CustomGroup",
                Gesture = new KeyGesture() { Key = DiagramKeys.G,  Modifiers = ModifierKeys.Control }
            },
            new Command()
            {
                Name = "CustomUngroup",
                Gesture = new KeyGesture() { Key = DiagramKeys.U,  Modifiers = ModifierKeys.Control }
            },
        };
      }
    }

    Parameter

    Specifies all additional parameters that are required at runtime.

    Declaration
    public string Parameter { get; set; }
    Property Value
    Type
    System.String

    Implements

    IDiagramObject
    System.ICloneable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved