Following code illustrates how to create the NavigationPane panel and the button, connect them and add them to the NavigationPane control:

VB:

Private Sub CreateNewPanel()
	Dim button As DevComponents.DotNetBar.ButtonItem
	button = New DevComponents.DotNetBar.ButtonItem()
	button.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText
 
	' Assign your image here instead of taking one from existing buttons
	button.Image = CType(ButtonItem1.Image.Clone(), Image)
	button.Name = "newButton"
	button.OptionGroup = "navBar"
	button.Text = "New Item"
 
	' Setup panel which is connected to button and acts as container for other controls
	Dim panel As DevComponents.DotNetBar.NavigationPanePanel
	panel = New DevComponents.DotNetBar.NavigationPanePanel()
	panel.AntiAlias = True
 
	' Add any controls to the panel by adding them to the Controls collection
	panel.Dock = System.Windows.Forms.DockStyle.Fill
	panel.DockPadding.Left = 1
	panel.DockPadding.Right = 1
	panel.DockPadding.Top = 1
	panel.Location = New System.Drawing.Point(0, 24)
 
	' Connect panel and the button
	panel.ParentItem = button
	panel.Size = New System.Drawing.Size(184, 214)
	panel.Style.Alignment = System.Drawing.StringAlignment.Center
	panel.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground
	panel.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2
	panel.Style.BackgroundImagePosition = DevComponents.DotNetBar.eBackgroundImagePosition.Tile
	panel.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine
	panel.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder
	panel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText
	panel.Style.GradientAngle = 90
	panel.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center
	panel.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center
 
	Me.NavigationPane1.Controls.Add(panel)
	Me.NavigationPane1.Items.Add(button)
	Me.NavigationPane1.RecalcLayout()
 
	' Select newly created panel
	button.Checked = True
End Sub

C#:

private void CreateNewPanel()
{
	DevComponents.DotNetBar.ButtonItem button = default(DevComponents.DotNetBar.ButtonItem);
	button = new DevComponents.DotNetBar.ButtonItem();
	button.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText;
 
	// Assign your image here instead of taking one from existing buttons
	button.Image = (Image)ButtonItem1.Image.Clone();
	button.Name = "newButton";
	button.OptionGroup = "navBar";
	button.Text = "New Item";
 
	// Setup panel which is connected to button and acts as container for other controls
	DevComponents.DotNetBar.NavigationPanePanel panel = default(DevComponents.DotNetBar.NavigationPanePanel);
	panel = new DevComponents.DotNetBar.NavigationPanePanel();
	panel.AntiAlias = true;
 
	// Add any controls to the panel by adding them to the Controls collection
	panel.Dock = System.Windows.Forms.DockStyle.Fill;
	panel.DockPadding.Left = 1;
	panel.DockPadding.Right = 1;
	panel.DockPadding.Top = 1;
	panel.Location = new System.Drawing.Point(0, 24);
 
	// Connect panel and the button
	panel.ParentItem = button;
	panel.Size = new System.Drawing.Size(184, 214);
	panel.Style.Alignment = System.Drawing.StringAlignment.Center;
	panel.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground;
	panel.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2;
	panel.Style.BackgroundImagePosition = DevComponents.DotNetBar.eBackgroundImagePosition.Tile;
	panel.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
	panel.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
	panel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText;
	panel.Style.GradientAngle = 90;
	panel.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
	panel.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
 
	this.NavigationPane1.Controls.Add(panel);
	this.NavigationPane1.Items.Add(button);
	this.NavigationPane1.RecalcLayout();
 
        // Select newly created panel
	button.Checked = true;
}

Following sample projects will create NavigationPane control using code only:

Click-here to download C# sample project.
Click-here to download VB sample project.

Related posts:

  1. How to Create Menu Using Code
  2. Changing NavigationPane Color Scheme
  3. How to Create Popup Menu or Toolbar Using Code
  4. How to Create Toolbars Using Code
  5. How to Create/Remove Tabs Using Code