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

Defines the fluent API for configuring the Telerik UI for ASP.NET Core Drawer.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class DrawerBuilder : WidgetBuilderBase<Drawer, DrawerBuilder>, IHtmlContent

Inheritance: objectHelperResultWidgetBuilderBase<Drawer, DrawerBuilder>DrawerBuilder

Implements: IHtmlContent

Inherited Members WidgetBuilderBase<Drawer, DrawerBuilder>.ToComponent()WidgetBuilderBase<Drawer, DrawerBuilder>.Expression(string)WidgetBuilderBase<Drawer, DrawerBuilder>.Explorer(ModelExplorer)WidgetBuilderBase<Drawer, DrawerBuilder>.Name(string)WidgetBuilderBase<Drawer, DrawerBuilder>.Deferred(bool)WidgetBuilderBase<Drawer, DrawerBuilder>.HtmlAttributes(object)WidgetBuilderBase<Drawer, DrawerBuilder>.HtmlAttributes(IDictionary<string, object>)WidgetBuilderBase<Drawer, DrawerBuilder>.ScriptAttributes(object, bool)WidgetBuilderBase<Drawer, DrawerBuilder>.ScriptAttributes(IDictionary<string, object>, bool)WidgetBuilderBase<Drawer, DrawerBuilder>.Render()WidgetBuilderBase<Drawer, DrawerBuilder>.ToHtmlString()WidgetBuilderBase<Drawer, DrawerBuilder>.WriteTo(TextWriter, HtmlEncoder)WidgetBuilderBase<Drawer, DrawerBuilder>.ToClientTemplate()WidgetBuilderBase<Drawer, DrawerBuilder>.AsModule(bool)WidgetBuilderBase<Drawer, DrawerBuilder>.ComponentWidgetBuilderBase<Drawer, DrawerBuilder>.ContainerHelperResult.WriteTo(TextWriter, HtmlEncoder)HelperResult.WriteActionobject.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

Initializes a new instance of the DrawerBuilder class.

C#
public DrawerBuilder(Drawer component)
Parameters:componentDrawer

Methods

Specifies if the Drawer will be automatically collapsed when an item is clicked.

C#
public DrawerBuilder AutoCollapse(bool value)
Parameters:valuebool

The value for AutoCollapse

Returns:

DrawerBuilder

Returns the current DrawerBuilder instance.

Example:
C#
@(Html.Kendo().Drawer()
.Name("drawer")
.AutoCollapse(true)
)

Defines the associated content for the Drawer.

C#
public DrawerBuilder Content(Action value)
Parameters:valueAction

The value of the content.

Returns:

DrawerBuilder

The HTML string representing the associated content for the Drawer.

C#
public DrawerBuilder Content(Func<object, object> value)
Parameters:valueFunc<object, object>

The value wrapped in a text tag.

Returns:

DrawerBuilder

Returns the current instance of DrawerBuilder to allow method chaining.

Example:
C#
@(Html.Kendo().Drawer()
.Name("drawer")
.Content(@&lt;text&gt;
&lt;span&gt;Content is here &lt;/span&gt;
&lt;/text&gt;)
)

Sets the HTML content of the Drawer from a partial view.

C#
public DrawerBuilder Content(IHtmlContent partialView)
Parameters:partialViewIHtmlContent

The partial view that provides the HTML content.

Returns:

DrawerBuilder

Returns the current instance of DrawerBuilder to allow method chaining.

Example:
C#
@(Html.Kendo().Drawer()
.Name("drawer")
.Content(Html.Partial("_DrawerContent"))
)

The HTML string representing the associated content for the Drawer.

C#
public DrawerBuilder Content(string value)
Parameters:valuestring

The value of the content.

Returns:

DrawerBuilder

Returns the current instance of DrawerBuilder to allow method chaining.

Example:
C#
@(Html.Kendo().Drawer()
.Name("drawer")
.Content(@"
&lt;span&gt;Content is here &lt;/span&gt;
")
)

Configures the client-side events.

C#
public DrawerBuilder Events(Action<DrawerEventBuilder> configurator)
Parameters:configuratorAction<DrawerEventBuilder>

The client events action.

Returns:

DrawerBuilder

Returns the current DrawerBuilder instance.

Example:
C#
@(Html.Kendo().Drawer()
.Name("Drawer")
.Events(events =&gt; events
.Hide("onHide")
)
)

Specifies if the Drawer will be expanded by default.

C#
public DrawerBuilder Expanded()
Returns:

DrawerBuilder

Returns the current DrawerBuilder instance.

Specifies if the Drawer will be expanded by default.

C#
public DrawerBuilder Expanded(bool value)
Parameters:valuebool

The value for Expanded

Returns:

DrawerBuilder

Returns the current DrawerBuilder instance.

Example:
C#
@(Html.Kendo().Drawer()
.Name("drawer")
.Expanded(true)
)

Specifies the items rendered by the Drawer when the top-level template option is not set. Each item can define text, icon, state, custom attributes, per-item template functions, and nested child items through items.items. If template is configured, it takes precedence and the items configuration is ignored.

C#
public DrawerBuilder Items(Action<DrawerItemFactory> configurator)
Parameters:configuratorAction<DrawerItemFactory>

The DrawerItemFactory for the items setting.

Returns:

DrawerBuilder

Returns the current instance of DrawerBuilder .

Specifies the minimum height for the drawer in push mode. The overlay mode takes 100% of the page height.

C#
public DrawerBuilder MinHeight(double value)
Parameters:valuedouble

The value for MinHeight

Returns:

DrawerBuilder

Returns the current DrawerBuilder instance.

Example:
C#
@(Html.Kendo().Drawer()
.Name("drawer")
.MinHeight(300)
)

Enables or configures the mini mode for the Kendo UI Drawer. This is a compact view that is displayed when the Kendo UI Drawer is collapsed. Usually it used to show only the icons when the drawer content contains icon and text for an item. When set to true it uses the main template.

C#
public DrawerBuilder Mini(Action<DrawerMiniSettingsBuilder> configurator)
Parameters:configuratorAction<DrawerMiniSettingsBuilder>

The DrawerMiniSettingsBuilder for the mini setting.

Returns:

DrawerBuilder

Returns the current instance of DrawerBuilder .

Enables or configures the mini mode for the Kendo UI Drawer. This is a compact view that is displayed when the Kendo UI Drawer is collapsed. Usually it used to show only the icons when the drawer content contains icon and text for an item. When set to true it uses the main template.

C#
public DrawerBuilder Mini(bool enabled)
Parameters:enabledbool

Enables or disables the mini option.

Returns:

DrawerBuilder

Returns the current instance of DrawerMiniSettingsBuilder .

Determines how the Kendo UI Drawer will interact with the associated content. The default one (overlay) will simply overlap the associated content with overlay effect. On the other hand "push" mode will show the drawer next to associated cotent. The associated content will shrink its content.

C#
public DrawerBuilder Mode(string value)
Parameters:valuestring

The value for Mode

Returns:

DrawerBuilder

Returns the current DrawerBuilder instance.

Example:
C#
@(Html.Kendo().Drawer()
.Name("drawer")
.Mode("push")
)

If set to true the use could navigate the widget using the keyboard navigation. By default keyboard navigation is disabled.

C#
public DrawerBuilder Navigatable()
Returns:

DrawerBuilder

Returns the current DrawerBuilder instance.

If set to true the use could navigate the widget using the keyboard navigation. By default keyboard navigation is disabled.

C#
public DrawerBuilder Navigatable(bool value)
Parameters:valuebool

The value for Navigatable

Returns:

DrawerBuilder

Returns the current DrawerBuilder instance.

Example:
C#
@(Html.Kendo().Drawer()
.Name("drawer")
.Navigatable(true)
)

The position of the drawer. Can be left (default) or right.

C#
public DrawerBuilder Position(string value)
Parameters:valuestring

The value for Position

Returns:

DrawerBuilder

Returns the current DrawerBuilder instance.

Example:
C#
@(Html.Kendo().Drawer()
.Name("drawer")
.Position("right")
)

If set to false, swiping the associated content will not activate the drawer. In this case, the drawer will only be open by calling the show method. should be disabled for browsers, which use side swiping gestures for back/forward navigation, such as iOS Safari. Otherwise, users should swipe from an inner part of the view, and not from the view edge.

C#
public DrawerBuilder SwipeToOpen(bool value)
Parameters:valuebool

The value for SwipeToOpen

Returns:

DrawerBuilder

Returns the current DrawerBuilder instance.

Example:
C#
@(Html.Kendo().Drawer()
.Name("drawer")
.SwipeToOpen(true)
)

Specifies the drawer's content. When configured, it takes precedence over items.

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

The value for Template

Returns:

DrawerBuilder

Returns the current DrawerBuilder instance.

Example:
C#
@(Html.Kendo().Drawer()
.Name("drawer")
.Template(Html.Kendo().Template().AddHtml("&lt;ul&gt;" +
"&lt;li data-role='drawer-item'&gt;&lt;span class='k-item-text' data-id='item1'&gt;Item 1&lt;/span&gt;&lt;/li&gt;" +
"&lt;li data-role='drawer-item'&gt;&lt;span class='k-item-text' data-id='item2'&gt;Item 2&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;"))
)

Specifies the drawer's content. When configured, it takes precedence over items.

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

A Template component that configures the template.

Returns:

DrawerBuilder

Returns the current DrawerBuilder instance.

Specifies the drawer's content. When configured, it takes precedence over items.

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

The handler that returs the template for Template

Returns:

DrawerBuilder

Returns the current DrawerBuilder instance.

Example:
C#
@(Html.Kendo().Drawer()
.Name("drawer")
.TemplateHandler("drawerTemplate")
)
&lt;script&gt;
function drawerTemplate() {
return `&lt;ul&gt;
&lt;li data-role='drawer-item'&gt;&lt;span class='k-item-text' data-id='item1'&gt;Item 1&lt;/span&gt;&lt;/li&gt;
&lt;li data-role='drawer-item'&gt;&lt;span class='k-item-text' data-id='item2'&gt;Item 2&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;`;
}
&lt;/script&gt;

Specifies the drawer's content. When configured, it takes precedence over items.

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

The ID of the template element for Template

Returns:

DrawerBuilder

Returns the current DrawerBuilder instance.

Example:
C#
@(Html.Kendo().Drawer()
.Name("drawer")
.TemplateId("drawer-template")
)
&lt;script id="drawer-template" type="text/x-kendo-template"&gt;
&lt;ul&gt;
&lt;li data-role='drawer-item'&gt;&lt;span class='k-item-text' data-id='item1'&gt;Item 1&lt;/span&gt;&lt;/li&gt;
&lt;li data-role='drawer-item'&gt;&lt;span class='k-item-text' data-id='item2'&gt;Item 2&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/script&gt;

Specifies the drawer's content. When configured, it takes precedence over items.

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

The view that contains the template for Template

Returns:

DrawerBuilder

Returns the current DrawerBuilder instance.

Example:
C#
@(Html.Kendo().Drawer()
.Name("drawer")
.TemplateView(Html.Partial("DrawerTemplateView"))
)

Defines a specific width for the Kendo UI Drawer when expanded.

C#
public DrawerBuilder Width(double value)
Parameters:valuedouble

The value for Width

Returns:

DrawerBuilder

Returns the current DrawerBuilder instance.

Example:
C#
@(Html.Kendo().Drawer()
.Name("drawer")
.Width(200)
)