Blazor

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class DiagramContextMenuSettings - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class DiagramContextMenuSettings

    It is a built-in menu loaded with few features which open when right-clicked.

    Inheritance
    System.Object
    Syncfusion.Blazor.SfBaseComponent
    Syncfusion.Blazor.SfBaseExtension
    DiagramContextMenuSettings
    Namespace: Syncfusion.Blazor.Diagrams
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class DiagramContextMenuSettings : SfBaseExtension
    Examples
      
    <SfDiagram @ref="@Diagram" Nodes="@NodeCollection">
    // Defines context menu and set the ShowCustomMenuOnly to false to render the custom context menu along with the default context menu
    <DiagramContextMenuSettings Show = "true" Items="@ContextMenuItemModels" >
    </DiagramContextMenuSettings>
    </SfDiagram>
    @code
    {
     //Reference to diagram
     SfDiagram Diagram;
     //Defines diagram's nodes collection
     public ObservableCollection<DiagramNode> NodeCollection = new ObservableCollection<DiagramNode>();
     protected override void OnInitialized()
     {
        //Create a node
        DiagramNode Node = new DiagramNode()
        {
          OffsetX = 100,
          OffsetY = 100,
          Height = 100,
          Width = 100,
          Id = "node1",
        };
        //Add node into node's collection
        NodeCollection.Add(Node);
      }
      // Add the custom context menu items
      List<ContextMenuItemModel> ContextMenuItemModels = new List<ContextMenuItemModel>()
      {
      new ContextMenuItemModel()
      {
         Text ="color",
         Id="Save",
          Target =".e-elementcontent",
          // Add the nested custom context menu items
         Items = new List<ContextMenuItemModel>()
       {
        new ContextMenuItemModel(){  Text ="Red", Id="Red", },
        new ContextMenuItemModel(){  Text ="Yellow", Id="Yellow", },
        new ContextMenuItemModel(){  Text ="Green", Id="Green", }
        }
        },
      };
     }

    Constructors

    DiagramContextMenuSettings()

    Declaration
    public DiagramContextMenuSettings()

    Fields

    DefaultContextMenuItemModels

    Declaration
    public List<ContextMenuItemModel> DefaultContextMenuItemModels
    Field Value
    Type Description
    System.Collections.Generic.List<ContextMenuItemModel>

    DIAGRAMCONTEXTMENU

    Declaration
    public static string DIAGRAMCONTEXTMENU
    Field Value
    Type Description
    System.String

    Properties

    ChildContent

    Represents a segment of UI content, implemented.

    Declaration
    public RenderFragment ChildContent { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.RenderFragment

    Items

    Defines the items to be displayed in the context menu.

    Declaration
    public List<ContextMenuItemModel> Items { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<ContextMenuItemModel>

    jsProperty

    Declaration
    protected override string jsProperty { get; set; }
    Property Value
    Type Description
    System.String
    Overrides
    Syncfusion.Blazor.SfBaseExtension.jsProperty

    mainParent

    Declaration
    protected override SfBaseExtension mainParent { get; set; }
    Property Value
    Type Description
    Syncfusion.Blazor.SfBaseExtension
    Overrides
    Syncfusion.Blazor.SfBaseExtension.mainParent

    Show

    Defines whether to enable or disable the context menu.

    Declaration
    public bool Show { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    By default, the Show is set to false. The context menu can be enabled by setting the Show to true.

    ShowCustomMenuOnly

    Enables only the custom menu items.

    Declaration
    public bool ShowCustomMenuOnly { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    By default, the ShowCustomMenuOnly is set to false. The context menu can be enabled by setting the ShowCustomMenuOnly to true.

    Examples
      
    <SfDiagram>
      // Define custom menu  <DiagramContextMenuSettings ShowCustomMenuOnly="true">    
    </DiagramContextMenuSettings></SfDiagram>

    Methods

    BuildRenderTree(RenderTreeBuilder)

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder

    Dispose()

    Declaration
    public override void Dispose()
    Overrides
    Syncfusion.Blazor.SfBaseExtension.Dispose()

    GetJSNamespace()

    Declaration
    public string GetJSNamespace()
    Returns
    Type Description
    System.String

    Get the parent namespaces

    OnAfterRenderAsync(Boolean)

    Declaration
    protected override Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    System.Boolean firstRender
    Returns
    Type Description
    System.Threading.Tasks.Task

    Returns asynchronous operation which is executed when the rendering of all the references to the component are populated

    Overrides
    Syncfusion.Blazor.SfBaseExtension.OnAfterRenderAsync(System.Boolean)

    OnHybridAfterRender(Boolean)

    Declaration
    protected Task OnHybridAfterRender(bool firstRender)
    Parameters
    Type Name Description
    System.Boolean firstRender
    Returns
    Type Description
    System.Threading.Tasks.Task

    Returns asynchronous operation which is executed when the rendering of all the references to the component are populated

    OnHybridInitialized()

    Declaration
    protected Task OnHybridInitialized()
    Returns
    Type Description
    System.Threading.Tasks.Task

    Returns asynchronous operation when the component is ready to start, having received its initial parameters from its parent in the render tree

    OnHybridParametersSet()

    Declaration
    protected Task OnHybridParametersSet()
    Returns
    Type Description
    System.Threading.Tasks.Task

    Returns asynchronous operation when the component has received parameters from its parent in the render tree, and the incoming values have been assigned to properties.

    OnInitializedAsync()

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    Returns asynchronous operation when the component is ready to start, having received its initial parameters from its parent in the render tree

    Overrides
    Syncfusion.Blazor.SfBaseComponent.OnInitializedAsync()

    OnParametersSetAsync()

    Declaration
    protected override Task OnParametersSetAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    Returns asynchronous operation when the component has received parameters from its parent in the render tree, and the incoming values have been assigned to properties

    Back to top Generated by DocFX
    Copyright © 2001 - 2021 Syncfusion Inc. All Rights Reserved