MenuBuilder
Defines the fluent API for configuring the Kendo UI Menu
Definition
Namespace:Kendo.Mvc.UI.Fluent
Assembly:Kendo.Mvc.dll
Syntax:
public class MenuBuilder : WidgetBuilderBase<Menu, MenuBuilder>, IHtmlContent
Inheritance: objectHelperResultWidgetBuilderBase<Menu, MenuBuilder>MenuBuilder
Implements:
Inherited Members
Constructors
Initializes a new instance of the MenuBuilder class.
Methods
Sets the menu animation options.
public MenuBuilder Animation(Action<PopupAnimationBuilder> animationAction)
The animation settings.
Returns:Returns the current MenuBuilder instance.
Disables the menu animation.
public MenuBuilder Animation(bool enable)
Boolean parameter.
Returns:Returns the current MenuBuilder instance.
Binds the menu to a list of objects. The menu will create a hierarchy of items using the specified mappings.
public MenuBuilder BindTo(IEnumerable dataSource, Action<NavigationBindingFactory<MenuItem>> factoryAction)
The data source.
factoryActionAction<NavigationBindingFactory<MenuItem>>The action which will configure the mappings
Returns:Returns the current MenuBuilder instance.
Binds the menu to a list of items. Use if the menu items are being sent from the controller. To bind the Menu declaratively, use the Items(Action<MenuItemFactory>) method.
public MenuBuilder BindTo(IEnumerable<MenuItem> items)
The list of items
Returns:Returns the current MenuBuilder instance.
Binds the menu to a list of objects. The menu will be "flat" which means a menu item will be created for every item in the data source.
public MenuBuilder BindTo<T>(IEnumerable<T> dataSource, Action<MenuItem, T> itemDataBound)
The data source.
itemDataBoundAction<MenuItem, T>The action executed for every data bound item.
Returns:Returns the current MenuBuilder instance.
Specifies that sub menus should close after item selection (provided they won't navigate).
public MenuBuilder CloseOnClick(bool value)
The value for CloseOnClick
Returns:Returns the current MenuBuilder instance.
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.
public MenuBuilder DataActionsField(string value)
The value for DataActionsField
Returns:Returns the current MenuBuilder instance.
Sets the field of the data item that provides the content of the menu items.
public MenuBuilder DataContentField(string value)
The value for DataContentField
Returns:Returns the current MenuBuilder instance.
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.
public MenuBuilder DataDescriptionField(string value)
The value for DataDescriptionField
Returns:Returns the current MenuBuilder instance.
Sets the field of the data item that provides the icon class of the menu items.
public MenuBuilder DataIconClassField(string value)
The value for DataIconClassField
Returns:Returns the current MenuBuilder instance.
Sets the field of the data item that provides the icon name of the menu items.The field can also hold an icon descriptor such as { name: "gear", variant: "outline" }. The variant can be outline, solid, or duotone; it applies to SVG rendering and is ignored for font icons.
public MenuBuilder DataIconField(string value)
The value for DataIconField
Returns:Returns the current MenuBuilder instance.
Sets the field of the data item that provides the image url of the menu items.
public MenuBuilder DataImageUrlField(string value)
The value for DataImageUrlField
Returns:Returns the current MenuBuilder instance.
Configure the DataSource of the component
public MenuBuilder DataSource(Action<HierarchicalDataSourceBuilder<object>> configurator)
The HierarchicalDataSourceBuilder<TModel> that configures the DataSource of the component.
Returns:Returns the current MenuBuilder instance.
Set ID of the DataSource that to be used for data binding
public MenuBuilder DataSource(string dataSourceId)
Returns the current MenuBuilder instance.
Sets the field of the data item that provides the sprite css class of the menu items.
public MenuBuilder DataSpriteCssClassField(string value)
The value for DataSpriteCssClassField
Returns:Returns the current MenuBuilder instance.
Sets the field of the data item that provides the text of the menu items.
public MenuBuilder DataTextField(string value)
The value for DataTextField
Returns:Returns the current MenuBuilder instance.
Sets the field of the data item that provides the url of the menu items.
public MenuBuilder DataUrlField(string value)
The value for DataUrlField
Returns:Returns the current MenuBuilder instance.
Specifies Menu opening direction.
public MenuBuilder Direction(MenuDirection value)
The desired direction.
Returns:Returns the current MenuBuilder instance.
Specifies Menu opening direction.
public MenuBuilder Direction(string value)
The desired direction.
Returns:Returns the current MenuBuilder instance.
Configures the client-side events.
public MenuBuilder Events(Action<MenuEventBuilder> configurator)
The client events action.
Returns:Returns the current MenuBuilder instance.
Select item depending on the current URL.
public MenuBuilder HighlightPath(bool value)
If true the item will be highlighted.
Returns:Returns the current MenuBuilder instance.
Specifies the delay in ms before the menu is opened/closed - used to avoid accidental closure on leaving.
public MenuBuilder HoverDelay(double value)
The value for HoverDelay
Returns:Returns the current MenuBuilder instance.
Specifies the position of the icon in the Menu items using the text content as a reference.
public MenuBuilder IconPosition(IconPosition value)
The value for IconPosition
Returns:Returns the current MenuBuilder instance.
Callback for each item.
public MenuBuilder ItemAction(Action<MenuItem> action)
Action, which will be executed for each item.
Returns:Returns the current MenuBuilder instance.
Defines the items in the menu
public MenuBuilder Items(Action<MenuItemFactory> addAction)
The add action.
Returns:Returns the current MenuBuilder instance.
Specifies that the root sub menus will be opened on item click.
public MenuBuilder OpenOnClick()
Returns the current instance of MenuOpenOnClickSettingsBuilder .
Specifies that the root sub menus will be opened on item click.
public MenuBuilder OpenOnClick(Action<MenuOpenOnClickSettingsBuilder> configurator)
The MenuOpenOnClickSettingsBuilder for the openonclick setting.
Returns:Returns the current instance of MenuBuilder .
Specifies that the root sub menus will be opened on item click.
public MenuBuilder OpenOnClick(bool enabled)
Enables or disables the openonclick option.
Returns:Returns the current instance of MenuOpenOnClickSettingsBuilder .
Specifies the orientation in which the menu items will be ordered.
public MenuBuilder Orientation(MenuOrientation value)
The value for Orientation
Returns:Returns the current MenuBuilder instance.
If enabled, the Menu displays buttons that scroll the items when they cannot fit the width or the popups' height of the Menu. By default, scrolling is disabled.The following example demonstrates how to enable the scrolling functionality.
public MenuBuilder Scrollable()
Returns the current instance of MenuScrollableSettingsBuilder .
If enabled, the Menu displays buttons that scroll the items when they cannot fit the width or the popups' height of the Menu. By default, scrolling is disabled.The following example demonstrates how to enable the scrolling functionality.
public MenuBuilder Scrollable(Action<MenuScrollableSettingsBuilder> configurator)
The MenuScrollableSettingsBuilder for the scrollable setting.
Returns:Returns the current instance of MenuBuilder .
If enabled, the Menu displays buttons that scroll the items when they cannot fit the width or the popups' height of the Menu. By default, scrolling is disabled.The following example demonstrates how to enable the scrolling functionality.
public MenuBuilder Scrollable(bool enabled)
Enables or disables the scrollable option.
Returns:Returns the current instance of MenuScrollableSettingsBuilder .
Defines the security trimming functionality of the component
public MenuBuilder SecurityTrimming(Action<SecurityTrimmingBuilder> securityTrimmingAction)
The securityTrimming action.
Returns:Returns the current MenuBuilder instance.
Enable/disable security trimming functionality of the component.
public MenuBuilder SecurityTrimming(bool value)
If true security trimming is enabled.
Returns:Returns the current MenuBuilder instance.
Sets the size of the component.
public MenuBuilder Size(ComponentSize value)
The value for Size
Returns:Returns the current MenuBuilder instance.