How to: Assign Images to Group Captions and Contained Links
This example assigns a large image to a group caption and small images to contained links. The NavElement.ImageOptions property gives access to SmallImage
and LargeImage
properties that specify images. The NavBarGroup.GroupCaptionUseImage property is set to Large
to display a large image within the group caption. The NavBarGroup.GroupStyle property is set to SmallIconsList
to display small images within links.
The following image shows a NavBarControl before and after sample code execution.
using DevExpress.XtraNavBar;
// ...
NavBarGroup helpGroup = navBarControl1.Groups[1];
helpGroup.ImageOptions.LargeImage = Image.FromFile("E:\\Images\\Icons\\MSHelpLarge.bmp");
NavBarItem indexItem = helpGroup.ItemLinks[0].Item;
indexItem.ImageOptions.SmallImage = Image.FromFile("E:\\Images\\Icons\\index.bmp");
NavBarItem contentsItem = helpGroup.ItemLinks[1].Item;
contentsItem.ImageOptions.SmallImage = Image.FromFile("E:\\Images\\Icons\\bookClosed.bmp");
helpGroup.GroupCaptionUseImage = NavBarImage.Small;
helpGroup.GroupStyle = NavBarGroupStyle.SmallIconsList;