Kendo.Mvc.UI.Fluent.MenuBuilder

Defines the fluent API for configuring the Kendo UI Menu

Methods

Items(System.Action<Kendo.Mvc.UI.Fluent.MenuItemFactory>)

Defines the items in the menu

Parameters

addAction System.Action<Kendo.Mvc.UI.Fluent.MenuItemFactory>

The add action.

Example (ASPX)

<%= Html.Kendo().Menu()
    .Name("Menu")
    .Items(items =>
    {
        items.Add().Text("First Item");
        items.Add().Text("Second Item");
    })
%>

Direction(System.String)

Specifies Menu opening direction.

Parameters

value System.String

The desired direction.

Example (ASPX)

<%= Html.Kendo().Menu()
    .Name("Menu")
    .Direction("top")
%>

BindTo(System.Collections.Generic.IEnumerable<T1>,System.Action<Kendo.Mvc.UI.MenuItem,T1>)

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.

Parameters

dataSource System.Collections.Generic.IEnumerable<T1>

The data source.

itemDataBound System.Action<Kendo.Mvc.UI.MenuItem,T1>

The action executed for every data bound item.

Example (ASPX)

<%= Html.Kendo().Menu()
    .Name("Menu")
    .BindTo(new []{"First", "Second"}, (item, value) =>
    {
        item.Text = value;
    })
%>

BindTo(System.Collections.IEnumerable,System.Action<Kendo.Mvc.UI.Fluent.NavigationBindingFactory<Kendo.Mvc.UI.MenuItem>>)

Binds the menu to a list of objects. The menu will create a hierarchy of items using the specified mappings.

Parameters

dataSource System.Collections.IEnumerable

The data source.

factoryAction System.Action<Kendo.Mvc.UI.Fluent.NavigationBindingFactory>

The action which will configure the mappings

Example (ASPX)

<%= Html.Kendo().Menu()
    .Name("Menu")
    .BindTo(Model, mapping => mapping
        .For<Customer>(binding => binding
            .Children(c => c.Orders) // The "child" items will be bound to the the "Orders" property
            .ItemDataBound((item, c) => item.Text = c.ContactName) // Map "Customer" properties to MenuItem properties
        )
        .For<Order<(binding => binding
            .Children(o => null) // "Orders" do not have child objects so return "null"
            .ItemDataBound((item, o) => item.Text = o.OrderID.ToString()) // Map "Order" properties to MenuItem properties
        )
    )
%>

CloseOnClick(System.Boolean)

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

Parameters

value System.Boolean

The value for CloseOnClick

HoverDelay(System.Double)

Specifies the delay in ms before the menu is opened/closed - used to avoid accidental closure on leaving.

Parameters

value System.Double

The value for HoverDelay

OpenOnClick(System.Action<Kendo.Mvc.UI.Fluent.MenuOpenOnClickSettingsBuilder>)

Specifies that the root sub menus will be opened on item click.

Parameters

configurator System.Action<Kendo.Mvc.UI.Fluent.MenuOpenOnClickSettingsBuilder>

The configurator for the openonclick setting.

OpenOnClick

Specifies that the root sub menus will be opened on item click.

OpenOnClick(System.Boolean)

Specifies that the root sub menus will be opened on item click.

Parameters

enabled System.Boolean

Enables or disables the openonclick option.

Scrollable(System.Action<Kendo.Mvc.UI.Fluent.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.

Parameters

configurator System.Action<Kendo.Mvc.UI.Fluent.MenuScrollableSettingsBuilder>

The configurator for the scrollable setting.

Scrollable

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.

Scrollable(System.Boolean)

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.

Parameters

enabled System.Boolean

Enables or disables the scrollable option.

Orientation(Kendo.Mvc.UI.MenuOrientation)

Specifies the orientation in which the menu items will be ordered

Parameters

value Kendo.Mvc.UI.MenuOrientation

The value for Orientation

Events(System.Action<Kendo.Mvc.UI.Fluent.MenuEventBuilder>)

Configures the client-side events.

Parameters

configurator System.Action<Kendo.Mvc.UI.Fluent.MenuEventBuilder>

The client events action.

Example (ASPX)

@(Html.Kendo().Menu()
    .Name("Menu")
    .Events(events => events
        .Close("onClose")
    )
)