Skip to main content

How to: Assign Images to Group Captions and Contained Links

The following sample code assigns a large image to a group caption and small images to contained links. The NavElement.SmallImage and NavElement.LargeImage properties of a group and items are used for this purpose. The NavBarGroup.UseSmallImage property is set to false to display a large image within the group caption. The NavBarGroup.GroupStyle property is set to true to display small images within links.

The image below displays a NavBarControl control before and after sample code execution.

Images - LargeSmallGroupsLinks

using DevExpress.XtraNavBar;
// ...
NavBarGroup helpGroup = navBarControl1.Groups[1];
helpGroup.LargeImage = Image.FromFile("E:\\Images\\Icons\\MSHelpLarge.bmp");      

NavBarItem indexItem = helpGroup.ItemLinks[0].Item;
indexItem.SmallImage = Image.FromFile("E:\\Images\\Icons\\index.bmp");

NavBarItem contentsItem = helpGroup.ItemLinks[1].Item;
contentsItem.SmallImage = Image.FromFile("E:\\Images\\Icons\\bookClosed.bmp");

helpGroup.UseSmallImage = false;
helpGroup.LinksUseSmallImage = true;