Class ContextMenuItem
Diagram provides some in-built context menu items and allows to define custom menu items.
Inheritance
System.Object
ContextMenuItem
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Syncfusion.JavaScript.DataVisualization.Models
Assembly: Syncfusion.EJ.dll
Syntax
public class ContextMenuItem
Constructors
ContextMenuItem()
Declaration
public ContextMenuItem()
Properties
CssClass
Appearance of the image in the contextmenu can be customized using cssClass property
Declaration
[JsonProperty("cssClass")]
public string CssClass { get; set; }
Property Value
Type | Description |
---|---|
System.String | String.Empty |
Examples
DiagramContextMenu ContextMenu = new DiagramContextMenu();
ContextMenu.Items.Add(new ContextMenuItem() { Name = "File", Text = "File", ImageUrl="../image1.png",cssClass="class name" });
ImageUrl
Set an image in context menu item using imageUrl property
Declaration
[JsonProperty("imageUrl")]
public string ImageUrl { get; set; }
Property Value
Type | Description |
---|---|
System.String | String.Empty |
Examples
DiagramContextMenu ContextMenu = new DiagramContextMenu();
ContextMenu.Items.Add(new ContextMenuItem() { Name = "File", Text = "File", ImageUrl="../image1.png" });
Name
Gets or sets the name of the context menu item
Declaration
[JsonProperty("name")]
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String | String.Empty |
Examples
DiagramContextMenu ContextMenu = new DiagramContextMenu();
ContextMenu.Items.Add(new ContextMenuItem() { Name = "File", Text = "File" });
SubItems
Gets or sets the sub items under the parent menu
Declaration
[JsonProperty("subItems")]
public List<ContextMenuItem> SubItems { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<ContextMenuItem> | List |
Examples
DiagramContextMenu ContextMenu = new DiagramContextMenu();
List<ContextMenuItem> SubItems = new List<ContextMenuItem>();
SubItems.Add(new ContextMenuItem() { Name = "Open", Text = "Open" });
SubItems.Add(new ContextMenuItem() { Name = "Close", Text = "Close" });
ContextMenu.Items.Add(new ContextMenuItem()
{
Name = "File",
Text = "File",
SubItems = subItems
});
TemplateId
Gets or sets the HTML template to be displayed on the context menu
Declaration
[JsonProperty("templateId")]
public string TemplateId { get; set; }
Property Value
Type | Description |
---|---|
System.String | String.Empty |
Examples
DiagramContextMenu ContextMenu = new DiagramContextMenu();
ContextMenu.Items.Add(new ContextMenuItem() { Name = "File", TeamplateId = "templateId" });
Text
Gets or sets the text to be displayed on the context menu
Declaration
[JsonProperty("text")]
public string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String | String.Empty |
Examples
DiagramContextMenu ContextMenu = new DiagramContextMenu();
ContextMenu.Items.Add(new ContextMenuItem() { Name = "File", Text = "File" });