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
Assembly: Syncfusion.Blazor.dll
public class DiagramContextMenuSettings : SfBaseExtension
<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
Declaration
public DiagramContextMenuSettings()
Fields
Declaration
public List<ContextMenuItemModel> DefaultContextMenuItemModels
Field Value
Declaration
public static string DIAGRAMCONTEXTMENU
Field Value
Type |
Description |
System.String |
|
Properties
Represents a segment of UI content, implemented.
Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type |
Description |
Microsoft.AspNetCore.Components.RenderFragment |
|
Defines the items to be displayed in the context menu.
Declaration
public List<ContextMenuItemModel> Items { get; set; }
Property Value
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
Defines whether to enable or disable the context menu.
Declaration
public bool Show { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Enables only the custom menu items.
Declaration
public bool ShowCustomMenuOnly { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
<SfDiagram>
// Define custom menu <DiagramContextMenuSettings ShowCustomMenuOnly="true">
</DiagramContextMenuSettings></SfDiagram>
Methods
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type |
Name |
Description |
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder |
__builder |
|
Declaration
public override void Dispose()
Overrides
Syncfusion.Blazor.SfBaseExtension.Dispose()
Declaration
public string GetJSNamespace()
Returns
Type |
Description |
System.String |
Get the parent namespaces
|
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)
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
|
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
|
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.
|
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()
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
|