Class DiagramBeforeMenuOpenEventArgs
Triggers before opening the context menu.
Inheritance
System.Object
DiagramBeforeMenuOpenEventArgs
Implements
System.IEquatable<DiagramBeforeMenuOpenEventArgs>
Namespace: Syncfusion.Blazor.Diagrams
Assembly: Syncfusion.Blazor.dll
Syntax
public class DiagramBeforeMenuOpenEventArgs : Object, IEquatable<DiagramBeforeMenuOpenEventArgs>
Examples
<SfDiagram Height="600px" Nodes="@NodeCollection" Constraints="@DiagramConstraints">
<DiagramEvents OnContextMenuOpen = "Open" ></ DiagramEvents >
< DiagramContextMenuSettings Show="true" Items="@ContextMenuItemModels" ShowCustomMenuOnly="true">
</DiagramContextMenuSettings>
</SfDiagram>
@code
{
//Defines diagram's nodes collection
public ObservableCollection<DiagramNode> NodeCollection = new ObservableCollection<DiagramNode>();
public DiagramConstraints DiagramConstraints = DiagramConstraints.Default;
public void Open(DiagramBeforeMenuOpenEventArgs args)
{
args.Cancel = true;
if ((args != null) && (args.Element != null) && (args.Event != null) && (args.Items != null))
{
Console.WriteLine("MenuOpen");
}
}
protected override void OnInitialized()
{
//Create a node
DiagramNode Node = new DiagramNode()
{
OffsetX = 100,
OffsetY = 100,
Height = 100,
Width = 100,
Id = "node1",
Shape = new DiagramShape() { Type = Syncfusion.Blazor.Diagrams.Shapes.Basic, BasicShape = BasicShapes.Ellipse },
Style = new NodeShapeStyle()
{
Fill = "#6BA5D7",
StrokeColor = "#6BA5D7",
},
};
//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-elementcontent1",
// 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
DiagramBeforeMenuOpenEventArgs()
Declaration
public DiagramBeforeMenuOpenEventArgs()
Properties
Cancel
Defines whether the user can prevent the context menu opening.
Declaration
public bool Cancel { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Element
Returns which element has been clicked.
Declaration
public DOM Element { get; set; }
Property Value
Type | Description |
---|---|
DOM |
Event
Returns event arguments.
Declaration
public EventArgs Event { get; set; }
Property Value
Type | Description |
---|---|
System.EventArgs |
HiddenItems
Returns the array of hidden context menu items.
Declaration
public List<string> HiddenItems { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<System.String> |
Items
Return the context menu items.
Declaration
public List<ContextMenuItemModel> Items { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<ContextMenuItemModel> |
Left
Returns the left position value of the clicked menu item.
Declaration
public double Left { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Name
Returns the name of the event.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ParentItem
Returns the parent menu items if the sub-menu opens.
Declaration
public ContextMenuItemModel ParentItem { get; set; }
Property Value
Type | Description |
---|---|
ContextMenuItemModel |
Top
Returns the top position value of the clicked menu item.
Declaration
public double Top { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Methods
Equals(DiagramBeforeMenuOpenEventArgs)
Indicates whether the DiagramBeforeMenuOpenEventArgs object is equal to another object of the same type.
Declaration
public bool Equals(DiagramBeforeMenuOpenEventArgs diagramBeforeMenuOpenEventArgs)
Parameters
Type | Name | Description |
---|---|---|
DiagramBeforeMenuOpenEventArgs | diagramBeforeMenuOpenEventArgs | Triggers before opening the context menu. |
Returns
Type | Description |
---|---|
System.Boolean | Returns the event before opening the context menu |
Implements
System.IEquatable<>