Back to Devexpress

PopupControlContainer Class

windowsforms-devexpress-dot-xtrabars-685f8605.md

latest11.8 KB
Original Source

PopupControlContainer Class

The control container that can be displayed as a dropdown.

Namespace : DevExpress.XtraBars

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXLicenseWinForms]
public class PopupControlContainer :
    PanelControl,
    PopupControl,
    IBarObject,
    ISupportLookAndFeel,
    IDXDropDownControlEx2,
    IDXDropDownControlEx,
    IDXDropDownControl
vb
<DXLicenseWinForms>
Public Class PopupControlContainer
    Inherits PanelControl
    Implements PopupControl,
               IBarObject,
               ISupportLookAndFeel,
               IDXDropDownControlEx2,
               IDXDropDownControlEx,
               IDXDropDownControl

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:

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.

csharp
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;
        }
    }
vb
Imports DevExpress.XtraBars
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Controls

    Partial Public Class Form1
        Inherits Form

        Private sampleDropDownButton As DropDownButton
        Private popupControlContainer1 As PopupControlContainer
        Private simpleButton2 As SimpleButton
        Private simpleButton1 As SimpleButton
        Private timeEdit1 As TimeEdit
        Private dateEdit1 As DateEdit
        Private labelControl5 As LabelControl
        Private labelControl4 As LabelControl

        Public Sub New()

            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"
            AddHandler simpleButton2.Click, AddressOf simpleButton2_Click

            simpleButton1.Location = New Point(76, 94)
            simpleButton1.Size = New Size(60, 24)
            simpleButton1.Text = "Now"
            AddHandler simpleButton1.Click, AddressOf simpleButton1_Click

            timeEdit1.Location = New Point(76, 47)
            timeEdit1.MenuManager = Me.barManager1
            timeEdit1.Size = New Size(130, 20)

            dateEdit1.Location = New Point(76, 17)
            dateEdit1.MenuManager = Me.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)
        End Sub

        Private Sub simpleButton1_Click(ByVal sender As Object, ByVal e As EventArgs)
            dateEdit1.DateTime = Date.Now
            timeEdit1.Time = dateEdit1.DateTime
        End Sub

        Private Sub simpleButton2_Click(ByVal sender As Object, ByVal e As EventArgs)
            dateEdit1.EditValue = Nothing
            timeEdit1.EditValue = Nothing
        End Sub
    End Class

Implements

IXtraResizableControl

IDXDropDownControl

Inheritance

Object MarshalByRefObject Component Control ScrollableControl XtraScrollableControl XtraPanel DevExpress.Utils.Controls.PanelBase PanelControl PopupControlContainer

See Also

PopupControlContainer Members

DropDownButton

ButtonStyle

DropDownControl

ApplicationButtonDropDownControl

DevExpress.XtraBars Namespace