Skip to main content

NavigationBarItem

Namespace: Wisej.Web.Ext.NavigationBar

Assembly: Wisej.Web.Ext.NavigationBar (4.1.0.0)

Represents a navigation item in the NavigationBar control.

public class NavigationBarItem : FlexLayoutPanel

A NavigationBarItem displays an Icon, a title (Text), an optional info "bubble" (InfoText), an optional shortcut button (ShowShortcut) and an open/close icon when it contains child items in its Items collection.

Constructors​

Initializes a new instance of the NavigationBarItem class.

Properties​

Instance member AllowHtml​

Boolean: Returns or sets a value indicating that the control can display HTML in the Text property. (Default: False)

Instance member BackColor​

Color: Returns or sets the background color.

The color is applied to the header of the item (icon and title row), not to the area containing the child items.

Instance member Cursor​

Cursor: Returns or sets the cursor displayed when the mouse pointer is over the NavigationBarItem. (Default: Cursor: Hand)

Instance member Expanded​

Boolean: Returns or sets whether the child items are expanded (visible). (Default: False)

Changing the value fires the Expand or Collapse event. When CompactView is true, setting this property to true doesn't expand the item: if it's a top-level item with child items, its children are shown in a popup NavigationBarMenu and the value remains false.

Example:

Expanding all the top-level items:

foreach (var item in this.navigationBar1.Items)
{
item.Expanded = true;
}

Instance member ExpandOnClick​

Boolean: Returns or sets whether to expand or collapse the item when clicking the item rather than having to click the open/close icon. (Default: True)

Instance member ForeColor​

Color: Returns or sets the text color.

The color is applied to the header of the item (icon and title row), not to the child items.

Instance member HasChildren​

Boolean: Returns whether the NavigationBarItem contains child items.

Instance member Hidden​

Boolean: Returns or sets whether the NavigationBarItem is hidden. (Default: False)

Setting this property to true sets Visible to false, and vice versa. Unlike Visible, this property is serializable by the designer.

Instance member Icon​

String: Returns or sets the icon of the NavigationBarItem. (Default: null)

The value can be a URL, a relative path to an image file, or the name of a theme icon. The icon is the only part of the item that remains visible when CompactView is true.

Instance member IconVisible​

Boolean: Returns or sets whether the item's icon is visible. (Default: True)

Instance member InfoText​

String: Returns or sets the text to show in the info "bubble" next to the item. (Default: "")

The bubble is visible only when the text is not empty and CompactView is false. Clicking it fires the InfoClick and ItemInfoClick events.

Example:

Showing the number of unread messages and hiding the bubble when there are none:

var count = GetUnreadMessageCount();
this.navigationBar1.Items["inbox"].InfoText = count > 0 ? count.ToString() : "";
this.navigationBar1.Items["inbox"].InfoTextBackColor = Color.Red;
this.navigationBar1.Items["inbox"].InfoTextForeColor = Color.White;

Instance member InfoTextBackColor​

Color: Returns or sets the background color of the info "bubble".

Instance member InfoTextForeColor​

Color: Returns or sets the text color of the info "bubble".

Instance member Items​

NavigationBarItemCollection: Returns the collection of child items to display in the NavigationBarItem.

Child items are visible only when the item is Expanded. Adding a child item shows the open/close icon and applies the ItemHeight and Indentation of the owner NavigationBar.

Example:

Adding child items and expanding the parent:

var reports = this.navigationBar1.Items["reports"];
reports.Items.Add("sales", "Sales", "Images/sales.svg");
reports.Items.Add("inventory", "Inventory", "Images/inventory.svg");
reports.Expanded = true;

Instance member Level​

Int32: Returns the indentation level of this NavigationBarItem item.

Top-level items have level 0, their children level 1, and so on.

NavigationBar: Returns the owner NavigationBar.

Returns null when the item has not been added to a NavigationBar (directly or through a parent item) yet.

Instance member Parent​

NavigationBarItem: Returns the parent NavigationBarItem or null.

Returns null for top-level items, which belong directly to the Items collection. This property hides Parent, which returns the internal container panel.

Instance member Selected​

Boolean: Returns whether the NavigationBarItem is the currently selected item.

To select an item, set the SelectedItem property. The selected item is rendered using the "selected" state of the theme.

Instance member ShortcutIcon​

String: Returns or sets the shortcut icon. (Default: "spinner-plus")

The value can be a URL, a relative path to an image file, or the name of a theme icon. The icon is displayed only when ShowShortcut is true.

Instance member ShowShortcut​

Boolean: Returns or sets whether the shortcut button is visible. (Default: False)

The shortcut button displays the ShortcutIcon and it's hidden when CompactView is true. Clicking it fires the ShortcutClick and ItemShortcutClick events.

Example:

Using the shortcut button to create a new record:

var customers = this.navigationBar1.Items["customers"];
customers.ShowShortcut = true;
customers.ShortcutIcon = "icon-add";
customers.ShortcutClick += (s, e) => new CustomerForm().Show();

Instance member Text​

String: Returns or sets the title of the NavigationBarItem. (Default: "")

The title is hidden when CompactView is true; in that case it's shown as the tooltip of the item unless ToolTipText is set.

Instance member Visible​

Boolean:

Methods​

Protected member CreateItemMenu()​

Creates the menu used to show child items when the CompactView property is set to true.

Returns: NavigationBarMenu. A NavigationBarMenu instance.

Protected member Dispose(disposing)​

Clean up any resources being used.

ParameterTypeDescription
disposingBooleantrue if managed resources should be disposed; otherwise, false.

Protected member OnCollapse(e)​

Fires the Collapsed event.

ParameterTypeDescription
eEventArgsNot used

Protected member OnExpand(e)​

Fires the Expanded event.

ParameterTypeDescription
eEventArgsNot used

Protected member OnInfoClick(e)​

Fires the InfoClick event.

ParameterTypeDescription
eEventArgsNot used

Protected member OnParentChanged(e)​

ParameterTypeDescription
eEventArgs

Protected member OnShortcutClick(e)​

Fires the ShortcutClick event.

ParameterTypeDescription
eEventArgsNot used

Instance member ResetBackColor()​

Resets the BackColor property to its default value.

Example:

Restoring the themed background after highlighting an item:

this.navigationBarItem1.BackColor = Color.LightYellow;
// ...
this.navigationBarItem1.ResetBackColor();

Instance member ResetForeColor()​

Resets the ForeColor property to its default value.

Example:

Restoring the themed text color:

this.navigationBarItem1.ForeColor = Color.Red;
// ...
this.navigationBarItem1.ResetForeColor();

Instance member Update()​

Updates the client side widget.

In design mode it also updates the owner NavigationBar.

Example:

Refreshing the item after changing several properties:

this.navigationBarItem1.Update();

Events​

Instance member Collapse​

EventHandler Fired when the NavigationBarItem is collapsed to hide child items.

Instance member Expand​

EventHandler Fired when the NavigationBarItem is expanded to show the child items.

Instance member InfoClick​

EventHandler Fired when the user clicks the info "bubble".

Instance member MouseEnter​

EventHandler

Instance member MouseLeave​

EventHandler

Instance member ShortcutClick​

EventHandler Fired when the user clicks the shortcut icon.

Instance member Swipe​

SwipeEventHandler

Implements​