alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class DiagramMenuClickEventArgs

    Provides information about the SfDiagramComponent context menu item click event.

    Inheritance
    object
    DiagramMenuClickEventArgs
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Syncfusion.Blazor.Diagram
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class DiagramMenuClickEventArgs
    Remarks

    This event argument class contains details about the clicked menu item and provides access to the menu item's properties when a context menu item is selected in the diagram component.

    Examples
     <SfDiagramComponent @ref="diagram" Height="600px" Width="90%">
    <ContextMenuSettings @bind-Show="@show"
                         @bind-ShowCustomMenuOnly="customMenuOnly" 
                         @bind-Items="@Items" 
                         ContextMenuOpening="@BeforeOpen" 
                         ContextMenuItemClick="@ItemClicked"> 
    </ContextMenuSettings>
    </SfDiagramComponent>
     @code {
    SfDiagramComponent diagram;
    ContextMenuSettings ContextMenuSettings;
    List<ContextMenuItem> Items;
    bool customMenuOnly = false;
    bool show = true;
    
    protected override void OnInitialized()
    {
        nodes = new DiagramObjectCollection<Node>();
        connectors = new DiagramObjectCollection<Connector>();
    
        Items = new List<ContextMenuItem>()
        {
                new ContextMenuItem()
                {
                    Text = "Save As...",
                    Id = "save",
                    //IconCss = "glyphicon glyphicon-pencil",
                },
                new ContextMenuItem()
                {
                    Text = "Group",
                    Id = "load",
                    //IconCss = "e-save"
                }
        };
    }
    private void BeforeOpen(DiagramBeforeMenuOpenEventArgs args)
    {
        foreach (ContextMenuItem Item in args.Items)
        {
            if (Item.Text == "Groups")
            {
                args.HiddenItems.Add(Item.Id);
            }
        }
    }
    private void ItemClicked(DiagramMenuEventArgs args)
    {
        if (args.Item.Text == "Group")
        {
            diagram.SelectAll();
            diagram.Group();
        }
    }

    Constructors

    DiagramMenuClickEventArgs()

    Declaration
    public DiagramMenuClickEventArgs()

    Properties

    Item

    Gets or sets the currently selected ContextMenuItem from the context menu.

    Declaration
    public ContextMenuItem? Item { get; set; }
    Property Value
    Type Description
    ContextMenuItem

    A ContextMenuItem representing the menu item that is currently selected by the user. The default value is null.

    Remarks

    This property is updated when a user selects an item from the context menu and can be used to track the current selection state.

    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved