MenuBuilder

Properties

WriteAction - Func

Methods

Animation(System.Boolean)

Disables the menu animation.

Parameters

enable - System.Boolean

Boolean parameter.

RETURNS

Returns the current MenuBuilder instance.

Example

Razor
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Animation(false)
            )
             

Animation(System.Action)

Sets the menu animation options.

Parameters

animationAction - System.Action<PopupAnimationBuilder>

The animation settings.

RETURNS

Returns the current MenuBuilder instance.

Example

Razor
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Animation(a => a.Open(o => o.Expand(ExpandDirection.Vertical)))
            )
             

Items(System.Action)

Defines the items in the menu

Parameters

addAction - System.Action<MenuItemFactory>

The add action.

RETURNS

Returns the current MenuBuilder instance.

Example

Razor
 
             @( 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.

RETURNS

Returns the current MenuBuilder instance.

Example

Razor
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Direction("top")
            )
             

Direction(Kendo.Mvc.UI.MenuDirection)

Specifies Menu opening direction.

Parameters

value - MenuDirection

The desired direction.

RETURNS

Returns the current MenuBuilder instance.

Example

Razor
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .Direction(MenuDirection.Left)
            )
             

DataSource(System.Action)

Configure the DataSource of the component

Parameters

configurator - System.Action<HierarchicalDataSourceBuilder>

The action that configures the DataSource of the component.

RETURNS

Returns the current MenuBuilder instance.

Example

Razor
 
             @( 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

RETURNS

Returns the current MenuBuilder instance.

BindTo(System.Collections.Generic.IEnumerable,System.Action)

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<T>

The data source.

itemDataBound - System.Action<MenuItem,T>

The action executed for every data bound item.

RETURNS

Returns the current MenuBuilder instance.

Example

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

BindTo(System.Collections.IEnumerable,System.Action)

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<NavigationBindingFactory>

The action which will configure the mappings

RETURNS

Returns the current MenuBuilder instance.

Example

Razor
 
             @( 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)

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<MenuItem>

The list of items

RETURNS

Returns the current MenuBuilder instance.

Example

Razor
 
             @( Html.Kendo().Menu()
                        .Name("TreeView")
                        .BindTo(model)
            )
             

ItemAction(System.Action)

Callback for each item.

Parameters

action - System.Action<MenuItem>

Action, which will be executed for each item.

RETURNS

Returns the current MenuBuilder instance.

Example

Razor
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .ItemAction(item =>
                        {
                            item
                                .Text(...)
                                .HtmlAttributes(...);
                        })
            )
             

HighlightPath(System.Boolean)

Select item depending on the current URL.

Parameters

value - System.Boolean

If true the item will be highlighted.

RETURNS

Returns the current MenuBuilder instance.

Example

Razor
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .HighlightPath(true)
            )
             

SecurityTrimming(System.Boolean)

Enable/disable security trimming functionality of the component.

Parameters

value - System.Boolean

If true security trimming is enabled.

RETURNS

Returns the current MenuBuilder instance.

Example

Razor
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .SecurityTrimming(false)
            )
             

SecurityTrimming(System.Action)

Defines the security trimming functionality of the component

Parameters

securityTrimmingAction - System.Action<SecurityTrimmingBuilder>

The securityTrimming action.

RETURNS

Returns the current MenuBuilder instance.

Example

Razor
 
             @( Html.Kendo().Menu()
                        .Name("Menu")
                        .SecurityTrimming(builder =>
                        {
                            builder.Enabled(true).HideParent(true);
                        })
            )
             

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

RETURNS

Returns the current MenuBuilder instance.

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

RETURNS

Returns the current MenuBuilder instance.

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

RETURNS

Returns the current MenuBuilder instance.

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

RETURNS

Returns the current MenuBuilder instance.

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

RETURNS

Returns the current MenuBuilder instance.

DataIconField(System.String)

Sets the field of the data item that provides the icon name of the menu items.

Parameters

value - System.String

The value for DataIconField

RETURNS

Returns the current MenuBuilder instance.

DataIconClassField(System.String)

Sets the field of the data item that provides the icon class of the menu items.

Parameters

value - System.String

The value for DataIconClassField

RETURNS

Returns the current MenuBuilder instance.

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

RETURNS

Returns the current MenuBuilder instance.

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

RETURNS

Returns the current MenuBuilder instance.

OpenOnClick(System.Action)

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

Parameters

configurator - System.Action<MenuOpenOnClickSettingsBuilder>

The configurator for the openonclick setting.

RETURNS

Returns the current instance of MenuBuilder .

OpenOnClick()

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

RETURNS

Returns the current instance of MenuBuilder .

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.

RETURNS

Returns the current instance of MenuOpenOnClickSettingsBuilder .

Scrollable(System.Action)

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<MenuScrollableSettingsBuilder>

The configurator for the scrollable setting.

RETURNS

Returns the current instance of MenuBuilder .

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.

RETURNS

Returns the current instance of MenuBuilder .

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.

RETURNS

Returns the current instance of MenuScrollableSettingsBuilder .

Orientation(Kendo.Mvc.UI.MenuOrientation)

Specifies the orientation in which the menu items will be ordered.

Parameters

value - MenuOrientation

The value for Orientation

RETURNS

Returns the current MenuBuilder instance.

IconPosition(Kendo.Mvc.UI.IconPosition)

Specifies the position of the icon in the Menu items using the text content as a reference.

Parameters

value - IconPosition

The value for IconPosition

RETURNS

Returns the current MenuBuilder instance.

Events(System.Action)

Configures the client-side events.

Parameters

configurator - System.Action<MenuEventBuilder>

The client events action.

RETURNS

Returns the current MenuBuilder instance.

Example

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

ToComponent()

Returns the internal view component.

RETURNS

The instance that represents the component.

Expression(System.String)

Sets the name of the component.

Parameters

modelExpression - System.String

RETURNS

Returns the current instance.

Explorer(Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer)

Sets the name of the component.

Parameters

modelExplorer - Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer

RETURNS

Returns the current instance.

Name(System.String)

Sets the name of the component.

Parameters

componentName - System.String

The name.

RETURNS

Returns the current instance.

Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with

Parameters

deferred - System.Boolean

RETURNS

Returns a DeferredWidgetBuilder instance.

HtmlAttributes(System.Object)

Sets the HTML attributes.

Parameters

attributes - System.Object

The HTML attributes.

RETURNS

Returns the current instance.

HtmlAttributes(System.Collections.Generic.IDictionary)

Sets the HTML attributes.

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

The HTML attributes.

RETURNS

Returns the current instance.

ScriptAttributes(System.Object,System.Boolean)

Sets the JavaScript attributes to the initialization script.

Parameters

attributes - System.Object

The JavaScript attributes.

overrideAttributes - System.Boolean

Argument which determines whether attributes should be overriden.

RETURNS

Returns the current instance.

ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)

Sets the JavaScript attributes to the initialization script.

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

The JavaScript attributes.

overrideAttributes - System.Boolean

Argument which determines whether attributes should be overriden.

RETURNS

Returns the current instance.

Render()

Renders the component in place.

ToHtmlString()

Returns the HTML representation of the component.

WriteTo(System.IO.TextWriter,System.Text.Encodings.Web.HtmlEncoder)

Parameters

writer - System.IO.TextWriter
encoder - System.Text.Encodings.Web.HtmlEncoder

ToClientTemplate()

Returns the client template for the component.

AsModule(System.Boolean)

Specifies whether the initialization script of the component will be rendered as a JavaScript module.

Parameters

value - System.Boolean

RETURNS

Returns the current instance.

In this article
PropertiesWriteAction - FuncMethodsAnimation(System.Boolean)Animation(System.Action)Items(System.Action)Direction(System.String)Direction(Kendo.Mvc.UI.MenuDirection)DataSource(System.Action)DataSource(System.String)BindTo(System.Collections.Generic.IEnumerable,System.Action)BindTo(System.Collections.IEnumerable,System.Action)BindTo(System.Collections.Generic.IEnumerable)ItemAction(System.Action)HighlightPath(System.Boolean)SecurityTrimming(System.Boolean)SecurityTrimming(System.Action)CloseOnClick(System.Boolean)DataTextField(System.String)DataUrlField(System.String)DataSpriteCssClassField(System.String)DataImageUrlField(System.String)DataIconField(System.String)DataIconClassField(System.String)DataContentField(System.String)HoverDelay(System.Double)OpenOnClick(System.Action)OpenOnClick()OpenOnClick(System.Boolean)Scrollable(System.Action)Scrollable()Scrollable(System.Boolean)Orientation(Kendo.Mvc.UI.MenuOrientation)IconPosition(Kendo.Mvc.UI.IconPosition)Events(System.Action)ToComponent()Expression(System.String)Explorer(Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer)Name(System.String)Deferred(System.Boolean)HtmlAttributes(System.Object)HtmlAttributes(System.Collections.Generic.IDictionary)ScriptAttributes(System.Object,System.Boolean)ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)Render()ToHtmlString()WriteTo(System.IO.TextWriter,System.Text.Encodings.Web.HtmlEncoder)ToClientTemplate()AsModule(System.Boolean)
Not finding the help you need?
Contact Support