PopupContainerControl Class
The dropdown panel for the PopupContainerEdit editor.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v24.2.dll
Declaration
Related API Members
The following members return PopupContainerControl objects:
Remarks
PopupContainerEdit and PopupContainerControl
controls allow you to create popups/dropdowns with custom layout and use them within look-up editors and data editors with popups (dropdowns):
Popup Container Control
The PopupContainerControl
is a panel/container that displays various UI controls and is used as the dropdown in the PopupContainerEdit
control. Do the following to use it:
- Drop UI controls onto the
PopupContainerControl
. To add UI control in code, use thePopupContainerControl.Controls
property. - Assign the
PopupContainerControl
to the PopupContainerEdit.Properties.PopupControl property.
Popup Container Edit
The PopupContainerEdit is a textbox-like data editor with the dropdown button. When the user clicks the dropdown button, the PopupContainerControl
assigned to the editor’s PopupContainerEdit.Properties.PopupControl property is shown.
EditValue and Display Text
Set the EditValue
Handle the QueryResultValue event to specify the e.Value
event parameter to set the editor’s value.
Set the Display Text
Handle the QueryDisplayText event and set the e.DisplayText
event parameter to specify the text displayed in the edit box. If you do not handle the QueryDisplayText
event, the PopupContainerEdit
will try to convert its EditValue
into a string.
void popupContainerEdit1_QueryDisplayText(object sender, DevExpress.XtraEditors.Controls.QueryDisplayTextEventArgs e) {
e.DisplayText = string.Format("{0} - {1} - {2}; {3}", textEdit1.Text, textEdit2.Text, textEdit3.Text, dateEdit1.DateOnly);
}
The following screenshot shows the result:
Display OK/Cancel Buttons
- Add OK and Cancel buttons to the
PopupContainerControl
. - Handle the Ok button’s
Click
event to call the ClosePopup() method. - Handle the Cancel button’s
Click
event to call the CancelPopup() method.
void ButtonCancel_Click(object sender, EventArgs e) {
popupContainerEdit1.CancelPopup();
}
void ButtonOK_Click(object sender, EventArgs e) {
popupContainerEdit1.ClosePopup();
}
Popup Events
- QueryPopUp - fires when the user clicks the dropdown button. Handle the
QueryPopUp
event to perform specific actions before the dropdown is displayed. For example, you can prevent the dropdown from being displayed based on a specific condition. Set thee.Cancel
event parameter to true to cancel the action. - CloseUp - fires if the user closes the popup panel or presses
ESC
to discard edits.
Examples (GitHub)
- How to Implement Multiple Selection for GridLookUpEdit
- How to Emulate an Editable GridLookUpEdit with PopupContainerEdit