Back to Devexpress

DropDownButton.DropDownControl Property

windowsforms-devexpress-dot-xtraeditors-dot-dropdownbutton.md

latest5.7 KB
Original Source

DropDownButton.DropDownControl Property

Gets or sets the popup control for the button.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(null)]
[DXCategory("Behavior")]
public virtual IDXDropDownControl DropDownControl { get; set; }
vb
<DXCategory("Behavior")>
<DefaultValue(Nothing)>
Public Overridable Property DropDownControl As IDXDropDownControl

Property Value

TypeDefaultDescription
IDXDropDownControlnull

A popup control object.

|

Remarks

You can use the following objects for a popup control:

Note

For the PopupMenu and PopupControlContainer objects to work correctly, ensure that they are associated with a BarManager or RibbonControl component. Use their Manager or Ribbon property to bind the objects to one of these components.

Before a popup control is displayed, the DropDownButton.ShowDropDownControl event is raised. Handle this event to dynamically customize the popup control, block it in specific cases, or supply a custom popup control dynamically.

The DropDownButton.ArrowButtonClick event allows you to display a custom popup control when the user clicks the drop-down arrow.

To open the popup control in code, call the DropDownButton.ShowDropDown method. The DropDownButton.HideDropDown method closes the popup control.

The code sample below illustrates how to add a drop-down menu to a drop-down button.

csharp
DXPopupMenu popupMenu = new DXPopupMenu();
popupMenu.Items.Add(new DXMenuItem() { Caption = "Menu Item" });
popupMenu.Items.Add(new DXMenuCheckItem() { Caption = "Check Item" });
dropDownButton1.DropDownControl = popupMenu;
vb
Dim popupMenu As New DXPopupMenu()
popupMenu.Items.Add(New DXMenuItem() With {.Caption = "Menu Item"})
popupMenu.Items.Add(New DXMenuCheckItem() With {.Caption = "Check Item"})
dropDownButton1.DropDownControl = popupMenu

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DropDownControl 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-assign-popupmenu-to-dropdownbutton/CS/DropDownButtonExample/Form1.cs#L23

csharp
//create and assign PopupMenu
    dropDownButton.DropDownControl = CreatePopupMenu(new BarItem[] { item1, item2 }, this.barManager1, "MyPopupMenu");
}

winforms-assign-popupmenu-to-dropdownbutton/VB/DropDownButtonExample/Form1.vb#L24

vb
'create and assign PopupMenu
    dropDownButton.DropDownControl = CreatePopupMenu(New BarItem() {item1, item2}, barManager1, "MyPopupMenu")
End Sub

See Also

ArrowButtonClick

HideDropDown()

IsOpened

ShowDropDown()

ShowDropDownControl

DXPopupMenu

PopupControlContainer

PopupMenu

DropDownButton Class

DropDownButton Members

DevExpress.XtraEditors Namespace