Example of Default Functionalities in ASP.NET MVC Toolbar Control
This sample demonstrates the default functionalities of the Toolbar. Select any command or click the left/right navigation icon or touch swipe to see the hidden commands of the Toolbar
simple Toolbar
Scrollable Toolbar
Popup Toolbar
MultiRow Toolbar
Extended Toolbar
@Html.UiToolbar(new UiToolbarOptions { Id = "defaultToolbar", Items = (List<UiToolbarItem>)ViewData["tbItems"] })
@Html.UiToolbar(new UiToolbarOptions { Id = "OverflowScrollable", Items = (List<UiToolbarItem>)ViewData["overflowItems"], OverflowMode = UiToolbarOverflowMode.Scrollable })
@Html.UiToolbar(new UiToolbarOptions { Id = "OverflowPopup", Items = (List<UiToolbarItem>)ViewData["overflowItems"], OverflowMode = UiToolbarOverflowMode.Popup })
@Html.UiToolbar(new UiToolbarOptions { Id = "OverflowMultiRow", Items = (List<UiToolbarItem>)ViewData["overflowItems"], OverflowMode = UiToolbarOverflowMode.MultiRow })
@Html.UiToolbar(new UiToolbarOptions { Id = "OverflowExtended", Items = (List<UiToolbarItem>)ViewData["overflowItems"], OverflowMode = UiToolbarOverflowMode.Extended })
<style>
/* Toolbar Styles */
.control-wrapper {
flex-direction: inherit
}
.control-section {
padding-bottom: 100px !important;
}
@@media only screen and (min-width: 1224px) {
}
@@media only screen and (min-width: 1824px) {
}
.control-section { padding-bottom: 100px; }
.e-sample-resize-container { max-width: 760px; margin: 0 auto; }
</style>
<div class="control-section">
<div class="e-sample-resize-container">
<h5 style="display: inline-block">simple Toolbar</h5>
@Html.UiToolbar(new UiToolbarOptions { Id = "defaultToolbar", Items = (List<UiToolbarItem>)ViewData["tbItems"] })
<br /><br />
<h5 style="display: inline-block">Scrollable Toolbar</h5>
@Html.UiToolbar(new UiToolbarOptions { Id = "OverflowScrollable", Items = (List<UiToolbarItem>)ViewData["overflowItems"], OverflowMode = UiToolbarOverflowMode.Scrollable })
<br /> <br />
<h5 style="display: inline-block">Popup Toolbar</h5>
@Html.UiToolbar(new UiToolbarOptions { Id = "OverflowPopup", Items = (List<UiToolbarItem>)ViewData["overflowItems"], OverflowMode = UiToolbarOverflowMode.Popup })
<br /> <br />
<h5 style="display: inline-block">MultiRow Toolbar</h5>
@Html.UiToolbar(new UiToolbarOptions { Id = "OverflowMultiRow", Items = (List<UiToolbarItem>)ViewData["overflowItems"], OverflowMode = UiToolbarOverflowMode.MultiRow })
<br /> <br />
<h5 style="display: inline-block">Extended Toolbar</h5>
@Html.UiToolbar(new UiToolbarOptions { Id = "OverflowExtended", Items = (List<UiToolbarItem>)ViewData["overflowItems"], OverflowMode = UiToolbarOverflowMode.Extended })
</div>
</div>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Lumen.UI.Mvc;
namespace YourApp.Controllers
{
public class ToolbarController : Controller
{
// The page is Views/Toolbar/DefaultFunctionalities.cshtml; it draws what ViewData holds.
public ActionResult DefaultFunctionalities()
{
List<UiToolbarItem> items = new List<UiToolbarItem>();
{
items.Add(new UiToolbarItem { IconCss = "e-icons e-cut", TooltipText = "Cut" });
items.Add(new UiToolbarItem { IconCss = "e-icons e-copy", TooltipText = "Copy" });
items.Add(new UiToolbarItem { IconCss = "e-icons e-paste", TooltipText = "Paste" });
items.Add(new UiToolbarItem { IconCss = "e-icons e-bold", TooltipText = "Bold" });
items.Add(new UiToolbarItem { IconCss = "e-icons e-underline", TooltipText = "Underline" });
items.Add(new UiToolbarItem { IconCss = "e-icons e-italic", TooltipText = "Italic" });
items.Add(new UiToolbarItem { IconCss = "e-icons e-align-left", TooltipText = "Align-Left" });
items.Add(new UiToolbarItem { IconCss = "e-icons e-align-right", TooltipText = "Align-Right" });
items.Add(new UiToolbarItem { IconCss = "e-icons e-align-center", TooltipText = "Align-Center" });
items.Add(new UiToolbarItem { IconCss = "e-icons e-justify", TooltipText = "Align-Justify" });
items.Add(new UiToolbarItem { IconCss = "e-icons e-list-unordered", TooltipText = "Bullets" });
}
ViewData["tbItems"] = items;
List<UiToolbarItem> item = new List<UiToolbarItem>();
{
item.Add(new UiToolbarItem { IconCss = "e-icons e-cut", TooltipText = "Cut", Text = "Cut" });
item.Add(new UiToolbarItem { IconCss = "e-icons e-copy", TooltipText = "Copy", Text = "Copy" });
item.Add(new UiToolbarItem { IconCss = "e-icons e-paste", TooltipText = "Paste", Text = "Paste" });
item.Add(new UiToolbarItem { IconCss = "e-icons e-bold", TooltipText = "Bold", Text = "Bold" });
item.Add(new UiToolbarItem { IconCss = "e-icons e-underline", TooltipText = "Underline", Text = "Underline" });
item.Add(new UiToolbarItem { IconCss = "e-icons e-italic", TooltipText = "Italic", Text = "Italic" });
item.Add(new UiToolbarItem { IconCss = "e-icons e-align-left", TooltipText = "Align-Left", Text = "Align-Left" });
item.Add(new UiToolbarItem { IconCss = "e-icons e-align-right", TooltipText = "Align-Right", Text = "Align-Right" });
item.Add(new UiToolbarItem { IconCss = "e-icons e-align-center", TooltipText = "Align-Center", Text = "Align-Center" });
item.Add(new UiToolbarItem { IconCss = "e-icons e-justify", TooltipText = "Align-Justify", Text = "Align-Justify" });
item.Add(new UiToolbarItem { IconCss = "e-icons e-list-unordered", TooltipText = "Bullets", Text = "Bullets" });
item.Add(new UiToolbarItem { IconCss = "e-icons e-list-ordered", TooltipText = "Numbering", Text = "Numbering" });
item.Add(new UiToolbarItem { IconCss = "e-icons e-undo", TooltipText = "Undo", Text = "Undo" });
item.Add(new UiToolbarItem { IconCss = "e-icons e-redo", TooltipText = "Redo", Text = "Redo" });
item.Add(new UiToolbarItem { IconCss = "e-icons e-increase-indent", TooltipText = "Text Indent", Text = "Text Indent" });
item.Add(new UiToolbarItem { IconCss = "e-icons e-decrease-indent", TooltipText = "Text Outdent", Text = "Text Outdent" });
item.Add(new UiToolbarItem { IconCss = "e-icons e-erase", TooltipText = "Clear", Text = "Clear" });
}
ViewData["overflowItems"] = item;
return View();
}
}
}
@* Install once: Install-Package Lumen.UI.Mvc (or: dotnet add package Lumen.UI.Mvc) *@
@* Views/Web.config: <add namespace="Lumen.UI.Mvc" /> *@
@* Views/Shared/_Layout.cshtml *@
<head>
@Html.UiStyles()
<link rel="stylesheet" href="~/Content/site.css" />
</head>
<body>
@RenderBody()
@Html.UiScripts()
@RenderSection("scripts", required: false)
</body>
Toolbar is a graphical control on which commands / buttons will be displayed in horizontal order. By default scrolling display mode enabled when content exceeds the available viewing area.
You can use left / right navigation icon or touch swipe to see the hidden commands of the toolbar.
Initially toolbar rendered with the left and right navigation icon and you can see hidden commands by moving in right or left direction.
When you reach right / left end of toolbar, corresponding navigation direction will be disabled.
In this demo, available responsive mode of Toolbar has been showcased. The modes can be set through overflowMode property and the possible modes are Scrollable, PopupPopup, Extended and MultiRow.
-
Scrollable- The scrollable mode is the default mode. When you have excess toolbar items, it can be viewed by scrolling through left and right arrows. You can continuously scroll the toolbar content by holding on the navigation icon. Indevicesnavigation icons are not available. you can touch swipe to see the hidden commands of the toolbar. -
Popup- The overflowing toolbar items which do not fit in viewing area moves to the popup container. -
Extended- The overflowing toolbar items which do not fit in the available space can be viewed in the next row of the toolbar on clicking the expand icon. -
MultiRow- The overflowing toolbar items which do not fit in viewing area will be displayed as an in-line of the toolbar.