MenuTagHelper
Kendo UI Menu TagHelper MenuTagHelper class.
Definition
Namespace:Kendo.Mvc.TagHelpers
Assembly:Kendo.Mvc.dll
Syntax:
[HtmlTargetElement("kendo-menu")]
[RestrictChildren("open-on-click", new string[] { "scrollable", "items", "popup-animation", "li", "hierarchical-datasource" })]
[OutputElementHint("ul")]
public class MenuTagHelper : TagHelperBase, ITagHelper, ITagHelperComponent, IDataBoundWidget<HierarchicalDataSourceTagHelper>
Inheritance: objectTagHelperTagHelperBaseMenuTagHelper
Implements:
Inherited Members
Example:
@addTagHelper *, Kendo.Mvc
<kendo-menu name="menu" hover-delay="500" direction="MenuDirection.Left" orientation="MenuOrientation.Horizontal">
<items>
<menu-item text="Menu Item 1" >
<sub-items>
<menu-item text="Sub Item 1" />
<menu-item text="Sub Item 2" />
<menu-item separator="true"></menu-item>
<menu-item text="Sub Item 3" />
<menu-item text="Sub Item 4" />
</sub-items>
</menu-item>
<menu-item text="Menu Item 2" >
<sub-items>
<menu-item text="Sub Item 1" />
<menu-item text="Sub Item 2" />
<menu-item separator="true"></menu-item>
<menu-item text="Sub Item 3" />
<menu-item text="Sub Item 4" />
</sub-items>
</menu-item>
</items>
<popup-animation>
<open effects="expand:vertical fade:in" />
</popup-animation>
</kendo-menu>
Child Tags
Constructors
MenuTagHelper method.
public MenuTagHelper(IKendoHtmlGenerator generator, IAuthorizationService authorizationService, IAuthorizationPolicyProvider policyProvider, IActionDescriptorCollectionProvider actionDescriptorCollection, IIconBuilder iconBuilder)
Properties
Binds a list of items to the Menu.
public IEnumerable<MenuItemBase> BindTo { get; set; }
Specifies that sub menus should close after item selection (provided they won't navigate).
public bool? CloseOnClick { get; set; }
Sets the field of the data item that provides the trailing actions-region content of the menu items, rendered as a k-menu-link-actions span positioned before the item's expand/collapse arrow. This is useful for displaying supplementary information next to a menu item's label, such as a keyboard-shortcut hint (for example, Ctrl+N). If not set, the Menu falls back to using the actions field of the data item. The actions content is rendered as raw, unencoded HTML, so make sure that any value supplied through dataActionsField (or through the item's actions field) is trusted in the same way as content supplied through dataContentField.
[HtmlAttributeName("dataactionsfield")]
public string DataActionsField { get; set; }
Sets the field of the data item that provides the content of the menu items.
[HtmlAttributeName("datacontentfield")]
public string DataContentField { get; set; }
Sets the field of the data item that provides the secondary description line of the menu items, rendered as a k-menu-link-description span displayed beneath the item's label. This is useful for showing additional context about a menu item, such as a short explanatory note under its title. If not set, the Menu falls back to using the description field of the data item. The description content is HTML-encoded by default, consistent with the item's text, and this can be disabled per item by setting encoded: false on the data item.
[HtmlAttributeName("datadescriptionfield")]
public string DataDescriptionField { get; set; }
Sets the field of the data item that provides the icon class of the menu items.
[HtmlAttributeName("dataiconclassfield")]
public string DataIconClassField { get; set; }
Sets the field of the data item that provides the icon name of the menu items.
[HtmlAttributeName("dataiconfield")]
public string DataIconField { get; set; }
Sets the field of the data item that provides the image url of the menu items.
[HtmlAttributeName("dataimageurlfield")]
public string DataImageUrlField { get; set; }
The Id of the data source.
[HtmlAttributeName("datasource-id")]
public string DataSourceId { get; set; }
Sets the field of the data item that provides the sprite css class of the menu items.
[HtmlAttributeName("dataspritecssclassfield")]
public string DataSpriteCssClassField { get; set; }
Sets the field of the data item that provides the text of the menu items.
[HtmlAttributeName("datatextfield")]
public string DataTextField { get; set; }
Sets the field of the data item that provides the url of the menu items.
[HtmlAttributeName("dataurlfield")]
public string DataUrlField { get; set; }
Represents the menu item opening direction.
public MenuDirection? Direction { get; set; }
Specifies the delay in ms before the menu is opened/closed - used to avoid accidental closure on leaving.
public double? HoverDelay { get; set; }
Specifies the position of the icon in the Menu items using the text content as a reference.
public IconPosition? IconPosition { get; set; }
The name of the JavaScript function that will handle the activate event. Fires when a sub menu gets opened and its animation finished.
public string OnActivate { get; set; }
The name of the JavaScript function that will handle the close event. Fires before a sub menu gets closed. You can cancel this event to prevent closure.
public string OnClose { get; set; }
The name of the JavaScript function that will handle the dataBound event. Fires when the Menu is bound to the set DataSource.
public string OnDataBound { get; set; }
The name of the JavaScript function that will handle the deactivate event. Fires when a sub menu gets closed and its animation finished.
public string OnDeactivate { get; set; }
The name of the JavaScript function that will handle the kendoKeydown event. Triggered when the user presses a keyboard key while the Menu is focused.The event handler function context (available via the this keyword) will be set to the widget instance.
public string OnKendoKeydown { get; set; }
The name of the JavaScript function that will handle the open event. Fires before a sub menu gets opened. You can cancel this event to prevent opening the sub menu.
public string OnOpen { get; set; }
The name of the JavaScript function that will handle the select event. Fires when a menu item gets selected.
public string OnSelect { get; set; }
Specifies the orientation in which the menu items will be ordered.
public MenuOrientation? Orientation { get; set; }
Specifies how Menu should adjust to screen boundaries. By default the strategy is "fit" for a sub menu with a horizontal parent, 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.
public string PopupCollision { get; set; }
Enables or disables the security trimming functionality for the menu component.
public bool? SecurityTrimming { get; set; }
Sets the size of the component.
public ComponentSize? Size { get; set; }
Methods
Gets the initialization script.
protected override string GetInitializationScript()
The initialization script.
Overrides:
public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
Overrides:
Serializes the defined settings.
public override IDictionary<string, object> Serialize()
Overrides:
SerializeEvents method.
protected override Dictionary<string, object> SerializeEvents()
Overrides:
SerializeSettings method.
protected override Dictionary<string, object> SerializeSettings()
Overrides:
Writes the HTML output.
protected override void WriteHtml(TagHelperOutput output)
The TagHelper output.
Overrides: