New to Telerik UI for ASP.NET Core? Start a free 30-day trial

Defines the fluent API for configuring ToolBarItem

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class ToolBarItemBuilder

Inheritance: objectToolBarItemBuilder

Inherited Members object.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

ToolBarItemBuilder method.

C#
public ToolBarItemBuilder(ToolBarItem container)
Parameters:containerToolBarItem

Properties

Gets the settings being configured.

C#
protected ToolBarItem Container { get; }

Methods

Specifies the buttons of ButtonGroup.

C#
public ToolBarItemBuilder Buttons(Action<ToolBarItemButtonFactory> configurator)
Parameters:configuratorAction<ToolBarItemButtonFactory>

The ToolBarItemButtonFactory for the buttons setting.

Returns:

ToolBarItemBuilder

Returns the current instance of ToolBarItemBuilder .

Specifies the click event handler of the button. Applicable only for commands of type button and splitButton.

C#
public ToolBarItemBuilder Click(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler code wrapped in a text tag.

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Specifies the click event handler of the button. Applicable only for commands of type button and splitButton.

C#
public ToolBarItemBuilder Click(string handler)
Parameters:handlerstring

The name of the JavaScript function that will be evaluated.

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Specifies whether the control is initially enabled or disabled. Default value is "true".

C#
public ToolBarItemBuilder Enable(bool value)
Parameters:valuebool

The value for Enable

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Enable(false);
})
)

Assigns the button to a group. Applicable only for buttons with togglable: true.

C#
public ToolBarItemBuilder Group(string value)
Parameters:valuestring

The value for Group

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Group("groupName");
})
)

Determines if a button is visible or hidden. By default buttons are visible.

C#
public ToolBarItemBuilder Hidden()
Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Determines if a button is visible or hidden. By default buttons are visible.

C#
public ToolBarItemBuilder Hidden(bool value)
Parameters:valuebool

The value for Hidden

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Hidden(true);
})
)
C#
public ToolBarItemBuilder HtmlAttributes(IDictionary<string, object> value)
Parameters:valueIDictionary<string, object>Returns:

ToolBarItemBuilder

Specifies the HTML attributes of a ToolBar button.

C#
public ToolBarItemBuilder HtmlAttributes(object value)
Parameters:valueobject

The value for HtmlAttributes

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Sets icon for the item. The icon should be one of the existing in the Kendo UI theme sprite.Set this option to 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.

C#
public ToolBarItemBuilder Icon(Action<ToolBarItemIconSettingsBuilder> configurator)
Parameters:configuratorAction<ToolBarItemIconSettingsBuilder>

The ToolBarItemIconSettingsBuilder for the icon setting.

Returns:

ToolBarItemBuilder

Returns the current instance of ToolBarItemBuilder .

Sets icon for the item. The icon should be one of the existing in the Kendo UI theme sprite.Set this option to 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.

C#
public ToolBarItemBuilder Icon(string icon)
Parameters:iconstring

The icon.

Returns:

ToolBarItemBuilder

Returns the current instance of ToolBarItemBuilder .

Specifies the ID of the button.

C#
public ToolBarItemBuilder Id(string value)
Parameters:valuestring

The value for Id

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Id("itemId");
})
)

If set, the ToolBar will render an image with the specified URL in the button.

C#
public ToolBarItemBuilder ImageUrl(string value)
Parameters:valuestring

The value for ImageUrl

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().ImageUrl("imageUrl");
})
)

Specifies the menu buttons of a SplitButton or a DropDownButton.

C#
public ToolBarItemBuilder MenuButtons(Action<ToolBarItemMenuButtonFactory> configurator)
Parameters:configuratorAction<ToolBarItemMenuButtonFactory>

The ToolBarItemMenuButtonFactory for the menubuttons setting.

Returns:

ToolBarItemBuilder

Returns the current instance of ToolBarItemBuilder .

Specifies how the button behaves when the ToolBar is resized.

C#
public ToolBarItemBuilder Overflow(ShowInOverflowPopup value)
Parameters:valueShowInOverflowPopup

The value for Overflow

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Overflow(ShowInOverflowPopup.Auto);
})
)

Specifies what element will be added in the command overflow popup. Applicable only for items that have a template.

C#
public ToolBarItemBuilder OverflowTemplate(string value)
Parameters:valuestring

The value for OverflowTemplate

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Specifies what element will be added in the command overflow popup. Applicable only for items that have a template.

C#
public ToolBarItemBuilder OverflowTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the overflowtemplate.

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Specifies what element will be added in the command overflow popup. Applicable only for items that have a template.

C#
public ToolBarItemBuilder OverflowTemplateHandler(string templateHandler)
Parameters:templateHandlerstring

The handler that returs the template for OverflowTemplate

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Specifies what element will be added in the command overflow popup. Applicable only for items that have a template.

C#
public ToolBarItemBuilder OverflowTemplateId(string templateId)
Parameters:templateIdstring

The ID of the template element for OverflowTemplate

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Specifies what element will be added in the command overflow popup. Applicable only for items that have a template.

C#
public ToolBarItemBuilder OverflowTemplateView(IHtmlContent templateView)
Parameters:templateViewIHtmlContent

The view that contains the template for OverflowTemplate

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Specifies whether the button is primary. Primary buttons receive different styling.

C#
public ToolBarItemBuilder Primary()
Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Specifies whether the button is primary. Primary buttons receive different styling.

C#
public ToolBarItemBuilder Primary(bool value)
Parameters:valuebool

The value for Primary

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Primary(true);
})
)

Specifies if the toggle button is initially selected. Applicable only for buttons with togglable: true.

C#
public ToolBarItemBuilder Selected()
Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Specifies if the toggle button is initially selected. Applicable only for buttons with togglable: true.

C#
public ToolBarItemBuilder Selected(bool value)
Parameters:valuebool

The value for Selected

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Selected(true);
})
)

Specifies where the icon will be displayed.

C#
public ToolBarItemBuilder ShowIcon(ShowIn value)
Parameters:valueShowIn

The value for ShowIcon

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().ShowIcon(ShowIn.Overflow);
})
)

Specifies where the text will be displayed.

C#
public ToolBarItemBuilder ShowText(ShowIn value)
Parameters:valueShowIn

The value for ShowText

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().ShowText(ShowIn.Overflow);
})
)

Defines a CSS class (or multiple classes separated by spaces) which will be used for button icon.

C#
public ToolBarItemBuilder SpriteCssClass(string value)
Parameters:valuestring

The value for SpriteCssClass

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().SpriteCssClass("k-icon k-font-icon k-i-refresh");
})
)

Specifies what element will be added in the ToolBar wrapper. Items with template does not have a type.

C#
public ToolBarItemBuilder Template(string value)
Parameters:valuestring

The value for Template

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Specifies what element will be added in the ToolBar wrapper. Items with template does not have a type.

C#
public ToolBarItemBuilder Template<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the template.

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Specifies what element will be added in the ToolBar wrapper. Items with template does not have a type.

C#
public ToolBarItemBuilder TemplateHandler(string templateHandler)
Parameters:templateHandlerstring

The handler that returs the template for Template

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Specifies what element will be added in the ToolBar wrapper. Items with template does not have a type.

C#
public ToolBarItemBuilder TemplateId(string templateId)
Parameters:templateIdstring

The ID of the template element for Template

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Specifies what element will be added in the ToolBar wrapper. Items with template does not have a type.

C#
public ToolBarItemBuilder TemplateView(IHtmlContent templateView)
Parameters:templateViewIHtmlContent

The view that contains the template for Template

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Sets the text of the button.

C#
public ToolBarItemBuilder Text(string value)
Parameters:valuestring

The value for Text

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Text("itemText");
})
)

Specifies if the button is togglable, e.g. has a selected and unselected state.

C#
public ToolBarItemBuilder Togglable()
Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Specifies if the button is togglable, e.g. has a selected and unselected state.

C#
public ToolBarItemBuilder Togglable(bool value)
Parameters:valuebool

The value for Togglable

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Type(CommandType.Button).Togglable(true);
})
)

Specifies the toggle event handler of the button. Applicable only for commands of type button and togglable: true.

C#
public ToolBarItemBuilder Toggle(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler code wrapped in a text tag.

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Specifies the toggle event handler of the button. Applicable only for commands of type button and togglable: true.

C#
public ToolBarItemBuilder Toggle(string handler)
Parameters:handlerstring

The name of the JavaScript function that will be evaluated.

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Specifies the type of the item.

C#
public ToolBarItemBuilder Type(CommandType value)
Parameters:valueCommandType

The value for Type

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Type(CommandType.Button);
})
)

Specifies the url to navigate to.

C#
public ToolBarItemBuilder Url(string value)
Parameters:valuestring

The value for Url

Returns:

ToolBarItemBuilder

Returns the current ToolBarItemBuilder instance.

Example:
C#
@(Html.Kendo().ToolBar()
.Name("toolBar")
.Items(items =&gt;
{
items.Add().Url("url");
})
)