Click here to Skip to main content
12,511,544 members (50,002 online)
Click here to Skip to main content
Add your own
alternative version


55 bookmarked

NavigationTree Control

, 28 Mar 2006
Rate this:
Please Sign up or sign in to vote.
A control providing a different kind of navigation in your app.

the NavigationTree control used in the demo project


This control provides a new kind of navigation for your applications. It uses the TreeNodes of a TreeView to offer functionality to the user.


I saw this control in a commercial application, and I liked the look and feel and the possibilities it gives to the programmer. Because I didn't see such a control anywhere else, I decided to develop one on my own and use it in one of my projects. I hope others like my NavigationTree, too.

Using the code

When using a NavigationTree, you have to define categories and items. Categories are represented by NavigationCategory objects, and items are represented by NavigationItem objects. Each item is owned by a category, and the categories are owned by the NavigationTree. Items can be organized hierarchically.

object hierarchy

Use categories to represent different parts of your application (like 'Customers', 'Manufacturers', 'Stock', an so on), and items to represent topics within a category (like 'customer list', 'search customer', 'new customer'). When a category is selected, its items will be displayed and the category header will be set.

When an item is selected, an event will be fired and your app can react on this event (e.g., display the customer list). You can use ImageLists to assign icons to NavigationItems and NavigationCategorys.

elements of the NavigationTree

At the moment, NavigationCategorys and NavigationItems can only be added by code at runtime:

NavigationCategory c1 = new NavigationCategory("Customers", 0);
c1.Name = "catCustomer";

NavigationItem i = new NavigationItem("Master Data", 0);
i.AddChild(new NavigationItem("Customer List", 1));
i.AddChild(new NavigationItem("Details", 2));

c1.AddItem(new NavigationItem("Orders", 3));
c1.AddItem(new NavigationItem("Invoices", 4));


Add delegates to be informed when a NavigationItem is going to be selected, a NavigationItem has been selected, or a NavigationCategory has been selected:

// NavigationCategory has been selected
navigationTree1.OnCategorySelected += new 

// NavigationItem is going to be selected
navigationTree1.OnBeforeItemSelect += new 

// NavigationItem has been selected
navigationTree1.OnItemSelected += new 

You can select NavigationItems by code:

// select a NavigationItem and fire
// BeforeItemSelect and ItemSelected events
// select a NavigationItem without fireing events (silent mode)

You can change the Text property of a NavigationItems by code:

// change the visible text of a NavigationItem...
myNavItem.Text = "a new text";
// ...and update this NavigationItem in the NavigationTree

Points of Interest

I improved the NavigationTree step by step, as more functionality was needed in my project, so some parts of the source look rather wild and are not well documented. I'm going to improve the source when posting future versions. Suggestions, improvements, and bug reports are welcome.


  • 3/28/06 - version 1.0 and demo project posted on CodeProject.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Jürgen Müller (jmse)
Web Developer
Germany Germany
Software developer, IT trainer and IT consultant since 1994. Most used programming languages are C#, VB 6.0 and Java.

You may also be interested in...


Comments and Discussions

GeneralTake a look at this Pin
CarlosI17-Oct-06 14:19
memberCarlosI17-Oct-06 14:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160929.1 | Last Updated 28 Mar 2006
Article Copyright 2006 by Jürgen Müller (jmse)
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid