windowsforms-devexpress-dot-xtrabars-677dd01c.md
Specifies a bar element.
Namespace : DevExpress.XtraBars
Assembly : DevExpress.XtraBars.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
public class BarItemLink :
IDisposable,
ICloneable,
IRibbonItem,
IBarLinkTimer,
ISupportRibbonKeyTip,
IToolTipLookAndFeelProvider,
ISupportAdornerElementBarItemLink,
ISupportAdornerElement,
IUpdateAdornerUI,
IImageDropInfo
Public Class BarItemLink
Implements IDisposable,
ICloneable,
IRibbonItem,
IBarLinkTimer,
ISupportRibbonKeyTip,
IToolTipLookAndFeelProvider,
ISupportAdornerElementBarItemLink,
ISupportAdornerElement,
IUpdateAdornerUI,
IImageDropInfo
The following members return BarItemLink objects:
Show 33 links
Bar items (BarItem objects) are bar buttons, menu commands, static captions, and other elements that can be placed in a toolbar, menu, or ribbon. A single bar item can be placed in a toolbar and menu at the same time. This allows users to invoke commands in any convenient way.
For this purpose, the BarManager creates item links (BarItemLink objects) based on bar items. An item link represents the corresponding bar item in a toolbar, menu, or ribbon. You can use link properties to customize the bar item in the toolbar and menu differently (for example, you can specify a short caption in the toolbar and a detailed caption in the menu).
For performance reasons, item links are not created until the form is loaded. That is why changing link properties is not in effect until the BarManager is loaded. If you specify a link property in code before the BarManager is loaded (for example, in the form’s constructor), call the BarManager.ForceLinkCreate or BarManager.ForceInitialize method first.
using DevExpress.XtraBars;
public Form1() {
InitializeComponent();
bm.ForceInitialize();
BarButtonItem bbiNew = new BarButtonItem(bm, "New");
bbiNew.ImageUri.Uri = "New";
BarItemLink link1 = bar1.AddItem(bbiNew);
// The BeginGroup property is not in effect until the BarManager component is initialized.
link1.BeginGroup = true;
}
Imports DevExpress.XtraBars
Public Sub New()
InitializeComponent()
bm.ForceInitialize()
Dim bbiNew As New BarButtonItem(bm, "New")
bbiNew.ImageUri.Uri = "New"
Dim link1 As BarItemLink = bar1.AddItem(bbiNew)
' The BeginGroup property is not in effect until the BarManager component is initialized.
link1.BeginGroup = True
End Sub
You can also specify link properties in the Form.Load event that fires when the BarManager is already loaded.
this.Load += Form1_Load;
private void Form1_Load(object sender, EventArgs e) {
BarButtonItem bbiNew = new BarButtonItem(bm, "New");
bbiNew.ImageUri.Uri = "New";
BarItemLink link1 = bar1.AddItem(bbiNew);
// The BeginGroup property is not in effect until the BarManager component is initialized.
link1.BeginGroup = true;
}
AddHandler Me.Load, AddressOf Form1_Load
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim bbiNew As New BarButtonItem(bm, "New")
bbiNew.ImageUri.Uri = "New"
Dim link1 As BarItemLink = bar1.AddItem(bbiNew)
' The BeginGroup property is not in effect until the BarManager component is initialized.
link1.BeginGroup = True
End Sub
Show 19 items
Object BarItemLink BarBaseButtonItemLink
See Also