Skip to main content
A newer version of this page is available. .

PopupContainerControl Class

The dropdown panel for the PopupContainerEdit editor.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v18.2.dll

Declaration

[ToolboxBitmap(typeof(ToolboxIconsRootNS), "PopupContainerControl")]
[SmartTagFilter(typeof(PopupContainerControlFilter))]
public class PopupContainerControl :
    PanelControl,
    ISupportLookAndFeel

Remarks

The PopupContainerEdit control represents a dropdown editor that can display custom controls within its dropdown. To display controls within the editor’s dropdown, you need to place them on an external panel represented by the PopupContainerControl control. The panel should then be assigned to the editor’s PopupContainerEdit.Properties.PopupControl property (see the RepositoryItemPopupContainerEdit.PopupControl topic). Once assigned, the panel is not visible on the form at runtime, and is only displayed as the bound editor’s popup window.

Note that a PopupContainerControl control can only be bound to a single PopupContainerEdit editor at a time.

Note

When a form containing a PopupContainerControl is disposed of by calling the form’s Dispose method, the PopupContainerControl.Dispose method may not be called. This takes place when the PopupContainerControl has been opened during the form’s lifetime. To free all the resources, you need to manually call the PopupContainerControl’s Dispose method. For instance, use the following code.


void Form1_Disposed(object sender, EventArgs e) {
    if (popupContainerControl1.IsDisposed) return;
    if (popupContainerControl1.Parent != null) return;
    popupContainerControl1.Dispose();
}

Please refer to the PopupContainerEdit topic for more information.

Example

The following example creates a PopupContainerEdit class instance and displays a RichTextBox control in the popup window.

First, we create and customize a RichTextBox control. Then, a PopupContainerControl object is created and this will contain the RichTextBox.

To display the PopupContainerControl in the popup window, it should be assigned to the RepositoryItemPopupContainerEdit.PopupControl property.

  RichTextBox rtb = new RichTextBox();
  rtb.Dock = DockStyle.Fill;
  PopupContainerControl popupControl = new PopupContainerControl();
  popupControl.Controls.Add(rtb);

  PopupContainerEdit editor = new PopupContainerEdit();
  editor.Properties.PopupControl = popupControl;
  Controls.Add(editor);

Inheritance

See Also