ContextMenuBuilder
Defines the fluent API for configuring the Kendo UI ContextMenu
Definition
Namespace:Kendo.Mvc.UI.Fluent
Assembly:Kendo.Mvc.dll
Syntax:
public class ContextMenuBuilder : WidgetBuilderBase<ContextMenu, ContextMenuBuilder>, IHtmlContent
Inheritance: objectHelperResultWidgetBuilderBase<ContextMenu, ContextMenuBuilder>ContextMenuBuilder
Implements:
Inherited Members
Constructors
Initializes a new instance of the ContextMenuBuilder class.
Methods
Specifies that ContextMenu should be shown aligned to the target or the filter element if specified.
public ContextMenuBuilder AlignToAnchor()
Returns the current ContextMenuBuilder instance.
Specifies that ContextMenu should be shown aligned to the target or the filter element if specified.
public ContextMenuBuilder AlignToAnchor(bool value)
The value for AlignToAnchor
Returns:Returns the current ContextMenuBuilder instance.
Sets the Animation options.
public ContextMenuBuilder Animation(Action<PopupAnimationBuilder> animationAction)
The animation settings.
Returns:Returns the current instance of ContextMenuBuilder for method chaining.
Enables or disables the Animation for the ContextMenu.
public ContextMenuBuilder Animation(bool enable)
Returns the current instance of ContextMenuBuilder for method chaining.
The DOM element to which the ContextMenu will be appended. The element needs to be relatively positioned.
public ContextMenuBuilder AppendTo(string value)
The value for AppendTo
Returns:Returns the current ContextMenuBuilder instance.
Binds the menu to a list of objects. The menu will create a hierarchy of items using the specified mappings.
public ContextMenuBuilder BindTo(IEnumerable dataSource, Action<NavigationBindingFactory<ContextMenuItem>> factoryAction)
The data source.
factoryActionAction<NavigationBindingFactory<ContextMenuItem>>The action which will configure the mappings
Returns:Returns the current instance of ContextMenuBuilder for method chaining.
Binds the menu to a list of items. Use if the menu items are being sent from the controller. To bind the ContextMenu declaratively, use the Items(Action<ContextMenuItemFactory>) method.
public ContextMenuBuilder BindTo(IEnumerable<ContextMenuItem> items)
The list of items
Returns:Returns the current instance of ContextMenuBuilder for method chaining.
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 ContextMenuBuilder BindTo<T>(IEnumerable<T> dataSource, Action<ContextMenuItem, T> itemDataBound)
The data source.
itemDataBoundAction<ContextMenuItem, T>The action executed for every data bound item.
Returns:Returns the current instance of ContextMenuBuilder for method chaining.
Specifies that sub menus should close after item selection (provided they won't navigate).
public ContextMenuBuilder CloseOnClick(bool value)
The value for CloseOnClick
Returns:Returns the current ContextMenuBuilder instance.
Copies and uses the styles from the anchor.
public ContextMenuBuilder CopyAnchorStyles(bool value)
The value for CopyAnchorStyles
Returns:Returns the current ContextMenuBuilder instance.
Sets the field of the data item that provides the content of the ContextMenu items.
public ContextMenuBuilder DataContentField(string value)
The value for DataContentField
Returns:Returns the current ContextMenuBuilder instance.
Sets the field of the data item that provides the image url of the ContextMenu items.
public ContextMenuBuilder DataImageUrlField(string value)
The value for DataImageUrlField
Returns:Returns the current ContextMenuBuilder instance.
Configure the DataSource of the component
public ContextMenuBuilder DataSource(Action<HierarchicalDataSourceBuilder<object>> configurator)
The HierarchicalDataSourceBuilder<TModel> that configures the DataSource of the component.
Returns:The current ContextMenuBuilder instance.
Sets the ID of the DataSource to be used for data binding
public ContextMenuBuilder DataSource(string dataSourceId)
Configures the DataSource ID.
Returns:Returns the current instance of ContextMenuBuilder for method chaining.
Sets the field of the data item that provides the sprite css class of the ContextMenu items.
public ContextMenuBuilder DataSpriteCssClassField(string value)
The value for DataSpriteCssClassField
Returns:Returns the current ContextMenuBuilder instance.
Sets the field of the data item that provides the text of the ContextMenu items.
public ContextMenuBuilder DataTextField(string value)
The value for DataTextField
Returns:Returns the current ContextMenuBuilder instance.
Sets the field of the data item that provides the url of the ContextMenu items.
public ContextMenuBuilder DataUrlField(string value)
The value for DataUrlField
Returns:Returns the current ContextMenuBuilder instance.
Specifies ContextMenu opening direction.
public ContextMenuBuilder Direction(string value)
The desired direction.
Returns:Returns the current instance of ContextMenuBuilder for method chaining.
Configures the client-side events.
public ContextMenuBuilder Events(Action<ContextMenuEventBuilder> configurator)
The client events action.
Returns:Returns the current ContextMenuBuilder instance.
Specifies ContextMenu filter selector - the ContextMenu will only be shown on items that satisfy the provided selector.
public ContextMenuBuilder Filter(string value)
The value for Filter
Returns:Returns the current ContextMenuBuilder instance.
Select item depending on the current URL.
public ContextMenuBuilder HighlightPath(bool value)
If true the item will be highlighted.
Returns:Returns the current instance of ContextMenuBuilder for method chaining.
Specifies the delay in ms before the sub menus are opened/closed - used to avoid accidental closure on leaving.
public ContextMenuBuilder HoverDelay(double value)
The value for HoverDelay
Returns:Returns the current ContextMenuBuilder instance.
Callback for each item.
public ContextMenuBuilder ItemAction(Action<ContextMenuItem> action)
Action, which will be executed for each item.
Returns:Returns the current instance of ContextMenuBuilder for method chaining.
Defines the items in the menu
public ContextMenuBuilder Items(Action<ContextMenuItemFactory> addAction)
The add action.
Returns:Returns the current instance of ContextMenuBuilder for method chaining.
Enables or disables the "open-on-click" feature.
public ContextMenuBuilder OpenOnClick(bool value)
Boolean parameter.
Returns:Returns the current instance of ContextMenuBuilder for method chaining.
Specifies the orientation in which the menu items will be ordered
public ContextMenuBuilder Orientation(ContextMenuOrientation value)
The value for Orientation
Returns:Returns the current ContextMenuBuilder instance.
If enabled, the ContextMenu displays buttons that scroll the items when they cannot fit the viewport height. By default, scrolling is disabled.
public ContextMenuBuilder Scrollable()
Returns the current instance of ContextMenuScrollableSettingsBuilder .
If enabled, the ContextMenu displays buttons that scroll the items when they cannot fit the viewport height. By default, scrolling is disabled.
public ContextMenuBuilder Scrollable(Action<ContextMenuScrollableSettingsBuilder> configurator)
The ContextMenuScrollableSettingsBuilder for the scrollable setting.
Returns:Returns the current instance of ContextMenuBuilder .
If enabled, the ContextMenu displays buttons that scroll the items when they cannot fit the viewport height. By default, scrolling is disabled.
public ContextMenuBuilder Scrollable(bool enabled)
Enables or disables the scrollable option.
Returns:Returns the current instance of ContextMenuScrollableSettingsBuilder .
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.
public ContextMenuBuilder ShowOn(string value)
The value for ShowOn
Returns:Returns the current ContextMenuBuilder instance.
Specifies the element on which ContextMenu should open. The default element is the document body.
public ContextMenuBuilder Target(string value)
The value for Target
Returns:Returns the current ContextMenuBuilder instance.