Creating Your Own Custom Navigation ToolStrip (Walkthrough)
By default, MM .NET uses the mmNavigationToolStrip class for the navigation ToolStrip. This topic provides a step-by-step walkthrough demonstrating how you can create your own custom navigation ToolStrip with additional buttons added to it. Specifically, the walkthrough demonstrates adding a Delete button to the ToolStrip.
Step 1: Create a ToolStrip Subclass
- In the Visual Studio Solution Explorer, right-click your Windows Forms project and select Add | New Item... from the shortcut menu.
- In the Add New Item dialog's Categories pane, select Visual C# Project Items or Visual Basic Items, then under Templates, select Component Class.
- Next, in the Name text box, enter "MyCustomNavToolStrip" and click the Add button (Visual Studio automatically adds the .cs or .vb extension)
- Right-click the component design surface and select View Code from the shortcut menu. At the top of the source code add the following namespace references.
In C#:
using System.Windows.Forms; using OakLeaf.MM.Main.Windows.Forms;
And in VB .NET:
Imports System.Windows.Forms Imports OakLeaf.MM.Main.Windows.Forms
- Specify that MyCustomNavToolStrip is based on mmToolStrip
In C#:
public partial class MyCustomNavToolStrip : mmToolStrip
And in VB .NET:
Public Class MyCustomNavToolStrip Inherits mmToolStrip
Step 2: Customizing the ToolStrip
In this step you add a custom button to the ToolStrip that deletes an item in the primary business object of the currently active form.
Note: If you're using VB .NET, you need to rebuild the solution before you can perform the following step.
- In the Visual Studio Solution Explorer, double-click the MyCustomNavToolStrip.cs or MyCustomNavToolStrip.vb file. This displays the ToolStrip in design mode.
- Go to the Properties Window, select the Items property and click its associated ellipses button [...].
- In the Items Collection Editor dialog's combo box, select mmToolStripButtonDelete and click the Add button:

- On the right side of the dialog, select the Image property and click its ellipses button [...]. This launches the Select Resource dialog:

- In the Select Resource dialog, click the Import... button. Navigate to a folder that contains the image you want to use.
- Click OK to close the Select Resource dialog
- In the Items Collection Editor dialog, select the ToolTipText property and set the text you want to appear. For example: Delete.
- Click OK to close the dialog.
Step 3: Overriding the ToolStrip Factory Method
In this final step you override the method that instantiates the ToolStrip.
- In the Solution Explorer, double-click the Factory.cs or Factory.vb source code file.
- If it doesn't already exist, add a reference to the following namespace to the top of the source code file.
In C#:
using OakLeaf.MM.Main.Windows.Forms;
And in VB .NET
Imports OakLeaf.MM.Main.Windows.Forms
- Add the following method to the Factory class.
In C#:
public override mmNavigationToolStrip CreateNavigationToolStrip() { mmNavigationToolStrip NavToolStrip = base.CreateNavigationToolStrip(); myToolStrip CustomToolStrip = new myToolStrip(); int ButtonCount = CustomToolStrip.Items.Count; for (int i = 0; i < ButtonCount; i++) { NavToolStrip.Items.Add(CustomToolStrip.Items[0]); } return NavToolStrip; }And in VB .NET:
Public Overrides Function CreateNavigationToolStrip() As mmNavigationToolStrip Dim NavToolStrip As mmNavigationToolStrip = MyBase.CreateNavigationToolStrip() Dim CustomToolStrip As New myCustomNavToolStrip() Dim ButtonCount As Integer = CustomToolStrip.Items.Count Dim i As Integer For i = 0 To ButtonCount - 1 NavToolStrip.Items.Add(CustomToolStrip.Items(0)) Next i Return NavToolStrip End Function
The ToolStrip at Runtime
When you run your application, the navigation ToolStrip should look something like this:
When you click the Delete button, the form should delete a record in the primary business object.
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/26/18
Comment or report problem with topic
