Back to Devexpress

BarItem.Caption Property

windowsforms-devexpress-dot-xtrabars-dot-baritem-5f4b198f.md

latest8.3 KB
Original Source

BarItem.Caption Property

The bar item’s caption.

Namespace : DevExpress.XtraBars

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Appearance")]
public virtual string Caption { get; set; }
vb
<DXCategory("Appearance")>
Public Overridable Property Caption As String

Property Value

TypeDescription
String

A string that specifies the bar item’s caption.

|

Remarks

Bar items can be displayed within Bars, Ribbon Control, and popup menus.

A caption is an item within a bar if the BarItem.PaintStyle property value of that item is set to the BarItemPaintStyle.Caption, BarItemPaintStyle.CaptionInMenu or BarItemPaintStyle.CaptionGlyph value or that item has no associated icon.

Use the Caption property to assign a hot key for the bar item. The hotkey is one of the caption symbols pressed together with the Alt key. The caption letter used in a hot key combination is defined by entering an ampersand before the required symbol (the appropriate symbol is underlined in the caption).

Note

Hot keys with an ampersand do not work in Ribbon UI. Read the following topic to learn more about quick keyboard access in Ribbon UI: Key Tips.

A RichEditControl allows you to create a Bars or Ribbon UI, where bars and Ribbon controls contain a set of predefined RichEditControl-aware commands (bar items). These items have predefined captions, which you can change according to your needs. Setting the Caption properties for these items to empty strings will result in reverting the captions to their initial values.

You can use HTML tags to format the Caption. To enable this feature for all bar items within a BarManager or RibbonControl, use the BarManager.AllowHtmlText and RibbonControl.AllowHtmlText property, respectively. To enable this feature for individual bar items, use the BarItem.AllowHtmlText property.

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.

winforms-richedit-emulate-the-ms-word-status-bar/CS/WindowsFormsApplication1/Form1.cs#L56

csharp
int currentPageIndex = richEdit.Views.PrintLayoutView.CurrentPageIndex;
barStaticItem3.Caption = string.Format("Current page: {0}", currentPageIndex + 1);

winforms-dashboard-display-each-series-in-separate-pane-for-chart-items/CS/MultiPaneExtension/MultiPaneModule.cs#L193

csharp
BarCheckItem barItem = new BarCheckItem();
barItem.Caption = barButtonEnableCaption;
barItem.ImageOptions.SvgImage = global::MultiPaneExtension.Properties.Resources.AddChartPaneButton;

create-winforms-radial-menu/CS/CreateRadialMenu/Form1.cs#L52

csharp
BarCheckItem btnCheckBold = new BarCheckItem(barManager, false);
btnCheckBold.Caption = "Bold";
btnCheckBold.ImageOptions.ImageUri.Uri = "Bold;Size16x16";

winforms-richedit-enable-line-numbering-and-count-document-rows/CS/LineNumberingExample/Form1.cs#L81

csharp
}
    resultBarStaticItem.Caption = String.Format("Document has {0} lines", visitor.RowIndex);
}

winforms-dashboard-custom-properties/CS/WinForms-Dashboard-Custom-Properties/Modules/ChartScaleBreakModule.cs#L36

csharp
BarCheckItem barItem = new BarCheckItem();
barItem.Caption = caption;
barItem.ImageOptions.SvgImage = barImage;

winforms-richedit-emulate-the-ms-word-status-bar/VB/WindowsFormsApplication1/Form1.vb#L46

vb
Dim currentPageIndex As Integer = richEdit.Views.PrintLayoutView.CurrentPageIndex
barStaticItem3.Caption = String.Format("Current page: {0}", currentPageIndex + 1)

winforms-dashboard-display-each-series-in-separate-pane-for-chart-items/VB/MultiPaneExtension/MultiPaneModule.vb#L165

vb
Dim barItem As New BarCheckItem()
barItem.Caption = barButtonEnableCaption
barItem.ImageOptions.SvgImage = My.Resources.AddChartPaneButton

create-winforms-radial-menu/VB/CreateRadialMenu/Form1.vb#L46

vb
Dim btnCheckBold As BarCheckItem = New BarCheckItem(barManager, False)
btnCheckBold.Caption = "Bold"
btnCheckBold.ImageOptions.ImageUri.Uri = "Bold;Size16x16"

winforms-richedit-enable-line-numbering-and-count-document-rows/VB/LineNumberingExample/Form1.vb#L77

vb
resultBarStaticItem.Caption = String.Format("Document has {0} lines", visitor.RowIndex)
End If

winforms-dashboard-custom-properties/VB/WinForms-Dashboard-Custom-Properties/Modules/ChartScaleBreakModule.vb#L36

vb
Dim barItem As New BarCheckItem()
barItem.Caption = caption
barItem.ImageOptions.SvgImage = barImage

See Also

Description

BarManager.AllowHtmlText

RibbonControl.AllowHtmlText

BarItem.AllowHtmlText

BarItem Class

BarItem Members

DevExpress.XtraBars Namespace