PopupControlContainer Class
The control container that can be displayed as a dropdown.
Namespace: DevExpress.XtraBars
Assembly: DevExpress.XtraBars.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
public class PopupControlContainer :
PanelControl,
PopupControl,
IBarObject,
ISupportLookAndFeel,
IDXDropDownControlEx2,
IDXDropDownControlEx,
IDXDropDownControl
Related API Members
The following members return PopupControlContainer objects:
Remarks
A PopupControlContainer object represents a panel that can contain any controls. This panel can be displayed as a dropdown for DropDownButton controls, bar buttons and the Ribbon Application Button.
A PopupControlContainer object can be created at design time by dragging the PopupControlContainer component from the Toolbox onto a form.
Note
For the PopupControlContainer object to work correctly, it must be bound to a BarManager or RibbonControl object using the PopupControlContainer.Manager or PopupControlContainer.Ribbon property, respectively.
After the panel has been created, you can add controls to it, and then bind the panel to a specific control using the following properties:
- for a DropDownButton control—use the DropDownButton.DropDownControl property;
- for a bar button—use the BarButtonItem.DropDownControl property. The BarButtonItem.ButtonStyle property must be set to BarButtonStyle.DropDown and the BarButtonItem.DropDownEnabled property must be set to true, to enable the dropdown functionality;
- for the Ribbon Application Button—use the RibbonControl.ApplicationButtonDropDownControl property.
Note
A PopupControlContainer is never displayed at runtime as a standalone panel. It can only be displayed as a dropdown.
Example
The example below shows how to assign a PopupControlContainer to a DropDownButton.
using DevExpress.XtraBars;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
public partial class Form1 : Form
{
DropDownButton sampleDropDownButton;
PopupControlContainer popupControlContainer1;
SimpleButton simpleButton2;
SimpleButton simpleButton1;
TimeEdit timeEdit1;
DateEdit dateEdit1;
LabelControl labelControl5;
LabelControl labelControl4;
public Form1()
{
InitializeComponent();
sampleDropDownButton = new DropDownButton();
popupControlContainer1 = new PopupControlContainer();
timeEdit1 = new TimeEdit();
dateEdit1 = new DateEdit();
labelControl5 = new LabelControl();
labelControl4 = new LabelControl();
simpleButton2 = new SimpleButton();
simpleButton1 = new SimpleButton();
simpleButton2.Location = new Point(142, 94);
simpleButton2.Size = new Size(64, 24);
simpleButton2.Text = "Clear";
simpleButton2.Click += new System.EventHandler(simpleButton2_Click);
simpleButton1.Location = new Point(76, 94);
simpleButton1.Size = new Size(60, 24);
simpleButton1.Text = "Now";
simpleButton1.Click += new System.EventHandler(simpleButton1_Click);
timeEdit1.Location = new Point(76, 47);
timeEdit1.MenuManager = this.barManager1;
timeEdit1.Size = new Size(130, 20);
dateEdit1.Location = new Point(76, 17);
dateEdit1.MenuManager = this.barManager1;
dateEdit1.Size = new Size(130, 20);
labelControl5.Location = new Point(17, 50);
labelControl5.Size = new Size(26, 13);
labelControl5.Text = "Time:";
labelControl4.Location = new Point(17, 20);
labelControl4.Size = new Size(27, 13);
labelControl4.Text = "Date:";
popupControlContainer1.BorderStyle = BorderStyles.NoBorder;
popupControlContainer1.Controls.Add(simpleButton2);
popupControlContainer1.Controls.Add(simpleButton1);
popupControlContainer1.Controls.Add(timeEdit1);
popupControlContainer1.Controls.Add(dateEdit1);
popupControlContainer1.Controls.Add(labelControl5);
popupControlContainer1.Controls.Add(labelControl4);
popupControlContainer1.Location = new Point(951, 12);
popupControlContainer1.Manager = barManager1;
popupControlContainer1.Size = new Size(220, 135);
popupControlContainer1.Visible = false;
sampleDropDownButton.DropDownControl = popupControlContainer1;
sampleDropDownButton.Location = new Point(32, 208);
sampleDropDownButton.Size = new Size(196, 35);
sampleDropDownButton.Text = "DropDown Button";
Controls.Add(sampleDropDownButton);
}
private void simpleButton1_Click(object sender, EventArgs e)
{
dateEdit1.DateTime = DateTime.Now;
timeEdit1.Time = dateEdit1.DateTime;
}
private void simpleButton2_Click(object sender, EventArgs e)
{
dateEdit1.EditValue = null;
timeEdit1.EditValue = null;
}
}