Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PopupContainerEdit() Constructor

Creates an instance of the PopupContainerEdit class.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#Declaration

public PopupContainerEdit()

#Remarks

The constructor allows you to create a PopupContainerEdit editor at runtime. This initializes all properties to their default values.

The editor is created with a single ButtonPredefines.Combo button type. Clicking the button invokes the popup window and displays its associated popup control. Use the RepositoryItemPopupContainerEdit.PopupControl property to specify the control to display in the popup.

#Example

The following example creates a PopupContainerControl with a RichTextBox inside, and assigns this control to a PopupContainerEdit editor.

using DevExpress.Utils;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.ViewInfo;
using System;
using System.Data;
using System.Windows.Forms;

namespace DXApplication10 {
    public partial class Form1 : DevExpress.XtraEditors.XtraForm {
        public Form1() {
            InitializeComponent();
            // ...
            this.Load += Form1_Load;
        }

        private void Form1_Load(object sender, EventArgs e) {
            CreatePopupEditor();
        }

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

            PopupContainerEdit editor = new PopupContainerEdit();
            editor.Location = new Point(100, 30);
            editor.Width = 350;
            editor.Properties.PopupControl = popupControl;
            Controls.Add(editor);

            editor.Closed += (s, a) => {
                (s as PopupContainerEdit).EditValue = rtb.Text;
            };

            editor.CustomDisplayText += (s, x) => {
                if (x.Value != null)
                    x.DisplayText = x.Value.ToString().TrimStart(' ', '\r', '\n');
            };
        }
    }
}
See Also