[Expand]General Information
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Collapse]Navigation Controls
   [Collapse]Navigation Bar
     Save and Restore Layout
       How to: Activate a Group
       How to: Adjust Group's Drag and Drop Options
       How to: Adjust the Control's Drag and Drop Options
       How to: Create a NavBar Control in Code
       How to: Create Groups and Items
       How to: Expand and Collapse Groups
       How to: Hide a NavBar's Item
       How to: Iterate Through Groups and Links of Each Group
       How to: Iterate Through NavBarControl Items
       How to: Keep Links Sorted
       How to: Prohibit Dropping to a Group
       How to: Embed a DateControl into a Group
      Responding to User Clicks at Runtime
    [Expand]Member Tables
     NavBarControl to AccondionControl Converter
   [Expand]Accordion Control
    Navigation Frame and Tab Pane
    Navigation Pane
    Tile Bar
   [Expand]TileNav Pane
    WindowsUI Button Panel
   [Expand]Office Navigation Bar
   [Expand]Tile Control
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Create a NavBar Control in Code

The following code shows how to create a NavBarControl in code. One group (Local) is added to the control containing three commands ("Inbox", "Outbox" and "Sent Items").

In the example, NavBarItem objects are created to represent the required commands. Their NavElement.Caption properties are initialized appropriately. These specify the display text for the items.

It's assumed that small images for NavBar items are stored in the imageList1 component. To use these images, the imageList1 is assigned to the NavBarControl.SmallImages property. Then images from the list are associated with specific NavBar items via the item's NavElement.SmallImageIndex property.

The NavBarControl.BeginUpdate and NavBarControl.EndUpdate methods are used to prevent excessive updates when mutiple control's properties are modified.

The image below shows the result:

Is this topic helpful?​​​​​​​