Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.

Images - LargeSmallGroupsLinks

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;