Adding Child items to DevExpress XtraNavBar

7.5k Views Asked by At

I am using the XtraNavBar from DevExpress and I would like to figure out how to add a child item to an existing item.

I have added Groups and Items to those Groups but I have been unable to figure out how to add child items to the Items.

Has anyone else done this? Can it be done either through code or any other way?


(for reference)

Product Page

Feature Page


Edit

I found ONE way to do this, HERE, but I was hoping there was another way, I guess. Building a separate control (TreeView I'd guess) and embedding it was not the answer I was HOPING for.....

1

There are 1 best solutions below

3
Francis B. On BEST ANSWER

See the XtraNavBar as a list of views where a NavBarGroup represents a view. That's why you cannot add child to a group.

In one of our applications, we are using this control. Each NavBarGroup has a container which contains a more sophisticated control.

Here a simple example how we do it:

//Create the group control container
NavBarGroupControlContainer groupContainer = new NavBarGroupControlContainer();
NavBarGroup group = new NavBarGroup("GroupName");
group.SmallImage  = new Icon("YourIcon.ico");
group.GroupStyle  = NavBarGroupStyle.ControlContainer;

m_navBar.Controls.Add(groupContainer);
group.ControlContainer = groupContainer;
group.Visible = true;

customControl.Dock = DockStyle.Fill;
groupContainer.Controls.Add(customControl);