[Expand]General Information
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Collapse]Editors and Simple Controls
   [Collapse]Simple Editors
    [Expand]Included Components
    [Expand]Editors Structure
    [Collapse]Editors Features
      Text Editing Overview
     [Expand]Mask Editors Overview
     [Expand]Format and Parse Editor Values
     [Expand]Editor Buttons
     [Collapse]Dropdown Editors Overview
       BLOB Editors
       Combo Box Editors
       Popup Container Editor
      Image Editing Menu
     [Expand]Data Binding Overview
     [Expand]Appearance Customization
     [Expand]Miscellaneous Features
    [Expand]Member Tables
   [Expand]Lookup Editors
   [Expand]Token Edit Control
   [Expand]Breadcrumb Edit Control
   [Expand]Range Control
   [Expand]Image Slider
    Camera Control
    Templated ListBox Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Member Tables
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Popup Container Editor

Expanded Popup Container Editor

PopupContainerEdit editors allow you to display controls within their popup windows. You can place any combination of controls onto a specially designed panel control and use this panel as the editor's popup window. The image below shows an example.

To display controls within the editor's dropdown window, you need to place them on an external panel represented by the PopupContainerControl control. The panel should then be assigned to the editor's RepositoryItemPopupContainerEdit.PopupControl property. Once assigned, the panel is not visible on the form at runtime and is only displayed as the bound editor's popup window.

Generally, you will need to synchronize an editor's value and display text with the state of controls residing within the popup window. To update the editor's value and text in response to changes made by end-users, handle the RepositoryItemPopupContainerEdit.QueryResultValue and RepositoryItemPopupContainerEdit.QueryDisplayText events. These events are raised when the popup window closes and changes made are not discarded. Thus, you can check the controls' state and assign an appropriate value to the editor. For instance, to update controls within the dropdown, you may handle the RepositoryItemPopupBase.QueryPopUp event. The event is raised just before the popup window opens.

Expanded Example - Displaying a Listbox Within the Dropdown

Assume you need to display a list box control together with OK and Cancel buttons within the popup window. The list box enables end-users to select multiple items. The buttons are used to close the dropdown accepting or discarding the changes made.

As stated above, these controls should be placed onto a PopupContainerControl panel, which in turn should be assigned to the editor's RepositoryItemPopupContainerEdit.PopupControl property.

The popup container editor's edit value should be an array containing the list box's selected items. The display text should reflect the number of selected items.

The form's constructor initializes the edit value with an empty System.Collections.ArrayList object.

The PopupContainerEdit.QueryResultValue event handler obtains selected items and adds them to an array representing the edit value. The list box residing within the popup window is called listBox1 in the code below.

The PopupContainerEdit.QueryDisplayText event is handled to display the number of selected items, i.e. the number of items in the array stored by the edit value.

The OK and Cancel buttons should close the popup window saving or discarding changes made. Thus, their Click event handlers call the PopupBaseEdit.ClosePopup and PopupBaseEdit.CancelPopup methods respectively. The editor is obtained via the popup control's PopupContainerControl.OwnerEdit property.

The end-user might change the selection, and then click the Cancel button or press the ESC key to discard changes. In this case, the selection is restored by obtaining the previously selected items from the editor's edit value. The PopupBaseEdit.CloseUp event handler performs this task.

Expanded See Also

Is this topic helpful?​​​​​​​