Skip to main content
Bar

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

BarButtonItem.DropDownControl Property

Gets or sets a Dropdown control for the BarButtonItem component.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#Declaration

[DefaultValue(null)]
public virtual PopupControl DropDownControl { get; set; }

#Property Value

Type Default Description
DevExpress.XtraBars.PopupControl null

A Dropdown control for the BarButtonItem component.

#Remarks

BarButtonItem objects may have a dropdown. A dropdown contains a specific control or a menu, which appears when users click the button (or its dropdown arrow). To enable the dropdown, set the BarButtonItem.ButtonStyle property to BarButtonStyle.DropDown, and assign a dropdown control to the DropDownControl property.

The DropDownControl property accepts the following objects:

The code sample below illustrates how to implement a bar button with zoom options in a dropdown.

using DevExpress.XtraEditors;
using DevExpress.XtraBars;

namespace WindowsFormsApp1
{
  public partial class XtraForm1 : DevExpress.XtraEditors.XtraForm
    {
    public XtraForm3()
        {
        InitializeComponent();

        BarManager barManager = new BarManager();
            barManager.Form = this;

            barManager.BeginUpdate();
            Bar bar1 = new Bar(barManager, "My Bar");
            bar1.DockStyle = BarDockStyle.Top;
            BarButtonItem buttonViewOutput = new BarButtonItem(barManager, "Zoom");
            bar1.AddItem(buttonViewOutput);
            barManager.EndUpdate();

            buttonViewOutput.ButtonStyle = BarButtonStyle.DropDown;
            buttonViewOutput.DropDownEnabled = true;

            Label scaleLabel = new Label();
            scaleLabel.Text = "Zoom to:";
            scaleLabel.Dock = DockStyle.Top;

            SpinEdit scaleSpin = new SpinEdit();
            scaleSpin.Dock = DockStyle.Bottom;
            scaleSpin.EditValue = 135;

            Label scaleSpinLabel = new Label();
            scaleSpinLabel.Width = 50;
            scaleSpinLabel.Padding = new Padding(0,10,0,0);
            scaleSpinLabel.Text = "Percent:";
            scaleSpinLabel.Dock = DockStyle.Left;

            RadioGroup scaleRadio = new RadioGroup();
            scaleRadio.Properties.Columns = 2;
            scaleRadio.Dock = DockStyle.Top;
            scaleRadio.Properties.Items.Add(new RadioGroupItem { Description="200%" });
            scaleRadio.Properties.Items.Add(new RadioGroupItem { Description = "100%" });
            scaleRadio.Properties.Items.Add(new RadioGroupItem { Description = "75%" });
            scaleRadio.Properties.Items.Add(new RadioGroupItem { Description = "Page width" });
            scaleRadio.Properties.Items.Add(new RadioGroupItem { Description = "Whole width" });

            PopupControlContainer container = new PopupControlContainer();
            container.Padding = new Padding(10);
            container.Height = 165;
            container.Width = 200;
            container.Manager = barManager1;
            container.Controls.Add(scaleSpin);
            container.Controls.Add(scaleSpinLabel);
            container.Controls.Add(scaleRadio);
            container.Controls.Add(scaleLabel);
            buttonViewOutput.DropDownControl = container;
        }
    }
}

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.

See Also