Skip to main content
A newer version of this page is available. .

NavElement.Caption Property

Gets or sets the element’s caption.

Namespace: DevExpress.XtraNavBar

Assembly: DevExpress.XtraNavBar.v19.1.dll

Declaration

[XtraSerializableProperty]
[SmartTagProperty("Caption", "Appearance", 0, SmartTagActionType.RefreshAfterExecute)]
public virtual string Caption { get; set; }

Property Value

Type Description
String

A string value specifying element caption.

Remarks

If the HTML formatting feature is enabled (see NavBarControl.AllowHtmlString and NavElement.AllowHtmlString), you can use HTML tags to format the NavElement.Caption. For detailed information, see HTML Text Formatting.

Example

The following sample code demonstrates how to add and modify groups, items and links between them. All elements are added via the Add method of the corresponding collection.

Captions are assigned to the added group and two items. This is performed via the NavElement.Caption property of the NavBarGroup and NavBarItem objects respectively. The NavElement.SmallImage property is used to display images within links.

The following image displays the control before and after code execution.

GroupsItemsLinks - Adding

using DevExpress.XtraNavBar;
// ...
// adding and adjusting a new group 
NavBarGroup helpGroup = navBarControl1.Groups.Add();
helpGroup.Caption = "Help Topics";
helpGroup.LinksUseSmallImage = true;

// adding and adjusting two items
NavBarItem indexItem = navBarControl1.Items.Add();
indexItem.Caption = "Index";
indexItem.SmallImage = Image.FromFile("E:\\Images\\Icons\\index.bmp");

NavBarItem contentsItem = navBarControl1.Items.Add();
contentsItem.Caption = "Contents";
contentsItem.SmallImage = Image.FromFile("E:\\Images\\Icons\\bookclosed.bmp");

// creating links between the group and items
helpGroup.ItemLinks.Add(indexItem);
helpGroup.ItemLinks.Add(contentsItem);

The following code snippets (auto-collected from DevExpress Examples) contain references to the Caption property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also