windowsforms-devexpress-dot-xtrabars-dot-barbuttonitem-a1894e4d.md
Assigns all core settings of a target link (caption, image, click event handler, and others) to this Bar Button Item.
Namespace : DevExpress.XtraBars
Assembly : DevExpress.XtraBars.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[Browsable(false)]
public BarItemLink DefaultDropDownLink { get; set; }
<Browsable(False)>
Public Property DefaultDropDownLink As BarItemLink
| Type | Description |
|---|---|
| BarItemLink |
The link whose settings are to be copied.
|
If a Bar Button has a drop-down menu (see the ButtonStyle property description), you can disable the ActAsDropDown property to split this button into two elements:
The DefaultDropDownLink property allows you to associate the main button element with any bar item link from its drop-down menu. This way, the copied link becomes easily accessible since users don’t need to invoke a drop-down menu to click it.
The code below illustrates how to copy settings from the last clicked link.
using DevExpress.XtraBars;
void UpdateDefaultButton(ItemClickEventArgs args) {
btnMain.DefaultDropDownLink = args.Link;
}
// ItemClick event handlers for drop-down menu buttons
void OnBtn1Click(object sender, ItemClickEventArgs e) {
UpdateDefaultButton(e);
// Do something
}
void OnBtn2Click(object sender, ItemClickEventArgs e) {
UpdateDefaultButton(e);
// Do something
}
void OnBtn3Click(object sender, ItemClickEventArgs e) {
UpdateDefaultButton(e);
// Do something
}
Imports DevExpress.XtraBars
Private Sub UpdateDefaultButton(ByVal args As ItemClickEventArgs)
btnMain.DefaultDropDownLink = args.Link
End Sub
' ItemClick event handlers for drop-down menu buttons
Private Sub OnBtn1Click(ByVal sender As Object, ByVal e As ItemClickEventArgs)
UpdateDefaultButton(e)
' Do something
End Sub
Private Sub OnBtn2Click(ByVal sender As Object, ByVal e As ItemClickEventArgs)
UpdateDefaultButton(e)
' Do something
End Sub
Private Sub OnBtn3Click(ByVal sender As Object, ByVal e As ItemClickEventArgs)
UpdateDefaultButton(e)
' Do something
End Sub
See Also