Back to Devexpress

BarButtonItem.DefaultDropDownLink Property

windowsforms-devexpress-dot-xtrabars-dot-barbuttonitem-a1894e4d.md

latest3.2 KB
Original Source

BarButtonItem.DefaultDropDownLink Property

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

Declaration

csharp
[Browsable(false)]
public BarItemLink DefaultDropDownLink { get; set; }
vb
<Browsable(False)>
Public Property DefaultDropDownLink As BarItemLink

Property Value

TypeDescription
BarItemLink

The link whose settings are to be copied.

|

Remarks

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 button itself. When users click it, the button’s own ItemClick event fires.
  • The drop-down button. Shows a drop-down menu when clicked.

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.

csharp
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
}
vb
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

BarButtonItem Class

BarButtonItem Members

DevExpress.XtraBars Namespace