Class DiagramMenuOpeningEventArgs
Notifies before opening context menu
Inheritance
System.Object
DiagramMenuOpeningEventArgs
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public class DiagramMenuOpeningEventArgs : 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
DiagramMenuOpeningEventArgs()
Declaration
public DiagramMenuOpeningEventArgs()
Properties
Cancel
Gets or sets the value indicates whether the user can prevent a menu from opening.
Declaration
public bool Cancel { get; set; }
Property Value
Type |
---|
System.Boolean |
HiddenItems
Gets or sets a value indicating the collection of hidden items associated with context menu.
Declaration
public List<string> HiddenItems { get; }
Property Value
Type |
---|
System.Collections.Generic.List<System.String> |
Items
Gets or sets the value indicates the collection of menu items.
Declaration
public List<ContextMenuItem> Items { get; }
Property Value
Type |
---|
System.Collections.Generic.List<ContextMenuItem> |