New to Telerik UI for ASP.NET Core? Start a free 30-day trial

Kendo UI ContextMenu TagHelper ContextMenuTagHelper class.

Definition

Namespace:Kendo.Mvc.TagHelpers

Assembly:Kendo.Mvc.dll

Syntax:

C#
[HtmlTargetElement("kendo-contextmenu")]
[RestrictChildren("items", new string[] { "popup-animation", "li", "hierarchical-datasource", "scrollable" })]
[OutputElementHint("ul")]
public class ContextMenuTagHelper : TagHelperBase, ITagHelper, ITagHelperComponent, IDataBoundWidget<HierarchicalDataSourceTagHelper>

Inheritance: objectTagHelperTagHelperBaseContextMenuTagHelper

Implements: IDataBoundWidget<HierarchicalDataSourceTagHelper>ITagHelperITagHelperComponent

Inherited Members TagHelperBase.MinimumValidatorTagHelperBase.MaximumValidatorTagHelperBase.Init(TagHelperContext)TagHelperBase.Process(TagHelperContext, TagHelperOutput)TagHelperBase.GetInitializator()TagHelperBase.VerifySettings()TagHelperBase.SerializeTemplates()TagHelperBase.GenerateId(TagHelperOutput)TagHelperBase.CreateHandler(string)TagHelperBase.GetRangeValidationParameter<TValue>(ModelExplorer, string)TagHelperBase.ExtractEditFormat(string)TagHelperBase.ToDictionaryHandler(IDictionary<string, string>)TagHelperBase.AddSelfToTemplate(TagHelperContext)TagHelperBase.ViewContextTagHelperBase.GeneratorTagHelperBase.InitializerTagHelperBase.WriterTagHelperBase.ScriptAttributesTagHelperBase.NameTagHelperBase.IdTagHelperBase.SelectorTagHelperBase.IdPrefixTagHelperBase.IsInClientTemplateTagHelperBase.DeferredTagHelperBase.AsModuleTagHelper.Orderobject.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Example:

csharp
@addTagHelper *, Kendo.Mvc

<kendo-contextmenu name="contextmenu" align-to-anchor="true">
</kendo-contextmenu>

Constructors

Initializes a new instance of the ContextMenuTagHelper class.

C#
public ContextMenuTagHelper(IKendoHtmlGenerator generator)
Parameters:generatorIKendoHtmlGenerator

Properties

Specifies that ContextMenu should be shown aligned to the target or the filter element if specified.

C#
public bool? AlignToAnchor { get; set; }

The DOM element to which the ContextMenu will be appended. The element needs to be relatively positioned.

C#
public string AppendTo { get; set; }

Specifies that sub menus should close after item selection (provided they won't navigate).

C#
public bool? CloseOnClick { get; set; }

Copies and uses the styles from the anchor.

C#
public bool? CopyAnchorStyles { get; set; }

Sets the field of the data item that provides the content of the ContextMenu items.

C#
[HtmlAttributeName("datacontentfield")]
public string DataContentField { get; set; }

Sets the field of the data item that provides the image url of the ContextMenu items.

C#
[HtmlAttributeName("dataimageurlfield")]
public string DataImageUrlField { get; set; }

The Id of the data source.

C#
[HtmlAttributeName("datasource-id")]
public string DataSourceId { get; set; }

Sets the field of the data item that provides the sprite css class of the ContextMenu items.

C#
[HtmlAttributeName("dataspritecssclassfield")]
public string DataSpriteCssClassField { get; set; }

Sets the field of the data item that provides the text of the ContextMenu items.

C#
[HtmlAttributeName("datatextfield")]
public string DataTextField { get; set; }

Sets the field of the data item that provides the url of the ContextMenu items.

C#
[HtmlAttributeName("dataurlfield")]
public string DataUrlField { get; set; }

Represents the menu item opening direction.

C#
public ContextMenuDirection? Direction { get; set; }

Specifies ContextMenu filter selector - the ContextMenu will only be shown on items that satisfy the provided selector.

C#
public string Filter { get; set; }

Specifies the delay in ms before the sub menus are opened/closed - used to avoid accidental closure on leaving.

C#
public double? HoverDelay { get; set; }

The name of the JavaScript function that will handle the activate event. Fires when a sub menu or the ContextMenu gets opened and its animation finished.

C#
public string OnActivate { get; set; }

The name of the JavaScript function that will handle the close event. Fires before a sub menu or the ContextMenu gets closed. You can cancel this event to prevent closure.

C#
public string OnClose { get; set; }

The name of the JavaScript function that will handle the dataBound event. Fires when the ContextMenu is bound to the set DataSource.

C#
public string OnDataBound { get; set; }

The name of the JavaScript function that will handle the deactivate event. Fires when a sub menu or the ContextMenu gets closed and its animation finished.

C#
public string OnDeactivate { get; set; }

The name of the JavaScript function that will handle the open event. Fires before a sub menu or the ContextMenu gets opened. You can cancel this event to prevent opening the sub menu.

C#
public string OnOpen { get; set; }

The name of the JavaScript function that will handle the select event. Fires when a menu item gets selected.

C#
public string OnSelect { get; set; }

Specifies the orientation in which the menu items will be ordered

C#
public ContextMenuOrientation? Orientation { get; set; }

Specifies how ContextMenu should adjust to screen boundaries. By default the strategy is "fit" for a sub menu with a horizontal parent or the root menu, meaning it will move to fit in screen boundaries in all directions, and "fit flip" for a sub menu with vertical parent, meaning it will fit vertically and flip over its parent horizontally. You can also switch off the screen boundary detection completely if you set the popupCollision to false.

C#
public string PopupCollision { get; set; }

Indicates whether security trimming is enabled.

C#
public bool? SecurityTrimming { get; set; }

Specifies the event or events on which ContextMenu should open. By default ContextMenu will show on contextmenu event on desktop and hold event on touch devices. Could be any pointer/mouse/touch event, also several, separated by spaces.

C#
public string ShowOn { get; set; }

Specifies the element on which ContextMenu should open. The default element is the document body.

C#
public string Target { get; set; }

Methods

Gets the initialization script.

C#
protected override string GetInitializationScript()
Returns:

string

The initialization script.

Overrides: TagHelperBase.GetInitializationScript()

C#
public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
Parameters:contextTagHelperContextoutputTagHelperOutputReturns:

Task

Overrides: TagHelper.ProcessAsync(TagHelperContext, TagHelperOutput)

Serializes the defined settings.

C#
public override IDictionary<string, object> Serialize()
Returns:

IDictionary<string, object>

Overrides: TagHelperBase.Serialize()

SerializeEvents method.

C#
protected override Dictionary<string, object> SerializeEvents()
Returns:

Dictionary<string, object>

Overrides: TagHelperBase.SerializeEvents()

SerializeSettings method.

C#
protected override Dictionary<string, object> SerializeSettings()
Returns:

Dictionary<string, object>

Overrides: TagHelperBase.SerializeSettings()

Writes the HTML output.

C#
protected override void WriteHtml(TagHelperOutput output)
Parameters:outputTagHelperOutput

The TagHelper output.

Overrides: TagHelperBase.WriteHtml(TagHelperOutput)