menu

Blazor

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

    Show / Hide Table of Contents

    Class DiagramMenuClickEventArgs

    Notifies when the context menu item gets clicked.

    Inheritance
    System.Object
    DiagramMenuClickEventArgs
    Namespace: Syncfusion.Blazor.Diagram
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class DiagramMenuClickEventArgs : Object
    Examples
    <SfDiagramComponent @ref="diagram" Height="600px" Width="90%">
    <ContextMenuSettings @bind-Show="@show"
                        @bind-ShowCustomMenuOnly="customMenuOnly" 
                        @bind-Items="@Items" 
                        ContextMenuOpening="@BeforeOpen" 
                        ContextMenuItemClicked="@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 a value indicates the selected item.

    Declaration
    public ContextMenuItem Item { get; set; }
    Property Value
    Type
    ContextMenuItem
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved