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")
%>
DataSource(System.Action<Kendo.Mvc.UI.Fluent.HierarchicalDataSourceBuilder<System.Object>>)
Configure the DataSource of the component
Parameters
configurator System.Action<Kendo.Mvc.UI.Fluent.HierarchicalDataSourceBuilder>
The action that configures the M:Kendo.Mvc.UI.Fluent.MenuBuilder.DataSource(System.Action{Kendo.Mvc.UI.Fluent.HierarchicalDataSourceBuilder{System.Object}}).
Example (ASPX)
<%= Html.Kendo().Menu()
.Name("Menu")
.DataSource(dataSource => dataSource
.Read(read => read
.Action("Employees", "PanelBar")
)
)
%>
DataSource(System.String)
Set ID of the DataSource that to be used for data binding
Parameters
dataSourceId System.String
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
)
)
%>
BindTo(System.Collections.Generic.IEnumerable<Kendo.Mvc.UI.MenuItem>)
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 method.
Parameters
items System.Collections.Generic.IEnumerable<Kendo.Mvc.UI.MenuItem>
The list of items
Example (ASPX)
<%= Html.Kendo().Menu()
.Name("TreeView")
.BindTo(model)
%>
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
DataTextField(System.String)
Sets the field of the data item that provides the text of the menu items.
Parameters
value System.String
The value for DataTextField
DataUrlField(System.String)
Sets the field of the data item that provides the url of the menu items.
Parameters
value System.String
The value for DataUrlField
DataSpriteCssClassField(System.String)
Sets the field of the data item that provides the sprite css class of the menu items.
Parameters
value System.String
The value for DataSpriteCssClassField
DataImageUrlField(System.String)
Sets the field of the data item that provides the image url of the menu items.
Parameters
value System.String
The value for DataImageUrlField
DataContentField(System.String)
Sets the field of the data item that provides the content of the menu items.
Parameters
value System.String
The value for DataContentField
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")
)
)