Back to Devexpress

RepositoryItemPopupContainerEdit.PopupControl Property

windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitempopupcontaineredit-4838c59b.md

latest9.0 KB
Original Source

RepositoryItemPopupContainerEdit.PopupControl Property

Gets or sets the control to display in the popup window.

Namespace : DevExpress.XtraEditors.Repository

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(null)]
[DXCategory("Data")]
public virtual PopupContainerControl PopupControl { get; set; }
vb
<DefaultValue(Nothing)>
<DXCategory("Data")>
Public Overridable Property PopupControl As PopupContainerControl

Property Value

TypeDefaultDescription
PopupContainerControlnull

A PopupContainerControl control to display in the popup window.

|

Remarks

To specify the content of a PopupContainerEdit editor’s popup window, first create a PopupContainerControl control. This control represents the panel which serves as the container for visual controls. Place the desired controls onto the container and assign it to the PopupControl property. The panel’s content will be displayed when the editor’s popup window is invoked.

Note : the size of the assigned control specifies the popup window’s initial size. You can stop users from changing the window’s size by using the RepositoryItemPopupContainerEdit.PopupSizeable property.

Example

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

csharp
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');
            };
        }
    }
}
vb
Imports Microsoft.VisualBasic
Imports DevExpress.Utils
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.ViewInfo
Imports System
Imports System.Data
Imports System.Windows.Forms

Namespace DXApplication10
    Partial Public Class Form1
        Inherits DevExpress.XtraEditors.XtraForm

        Public Sub New()
            InitializeComponent()
            ' ...
            AddHandler Me.Load, AddressOf Form1_Load
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
            CreatePopupEditor()
        End Sub

        Private Sub CreatePopupEditor()
            Dim rtb As New RichTextBox()
            rtb.Dock = DockStyle.Fill
            Dim popupControl As New PopupContainerControl()
            popupControl.Controls.Add(rtb)

            Dim editor As New PopupContainerEdit()
            editor.Location = New Point(100, 30)
            editor.Width = 350
            editor.Properties.PopupControl = popupControl
            Controls.Add(editor)

            AddHandler editor.Closed, Sub(s, a) TryCast(s, PopupContainerEdit).EditValue = rtb.Text

            AddHandler editor.CustomDisplayText, Sub(s, x)
                If x.Value IsNot Nothing Then
                    x.DisplayText = x.Value.ToString().TrimStart(" "c, ControlChars.Cr, ControlChars.Lf)
                End If
            End Sub
        End Sub
    End Class
End Namespace

The following code snippets (auto-collected from DevExpress Examples) contain references to the PopupControl property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-gridlookupedit-multiple-item-selection/CS/Form1.cs#L28

csharp
popupControl.Size = new System.Drawing.Size(500, 300);
ri.PopupControl = popupControl;

winforms-grid-use-layoutview-as-master-view/CS/WindowsApplication3/MasterDetailHelper.cs#L97

csharp
RepositoryItemPopupContainerEdit item = new RepositoryItemPopupContainerEdit();
item.PopupControl = CreatePopupControl();
item.ShowPopupCloseButton = item.ShowPopupShadow = false;

winforms-create-editable-grid-lookup/CS/PopupContainerEditSelection/Form1.cs#L28

csharp
popupContainerEdit1.Properties.PopupControl = popupContainerControl1;
popupContainerEdit1.Properties.ShowPopupCloseButton = false;

winforms-grid-popupcontaineredit-with-dynamic-content/CS/Q148684/Form1.cs#L40

csharp
gridEditor.Dock = DockStyle.Fill;
    detailsEdit.PopupControl = new PopupContainerControl();
}

winforms-gridlookupedit-multiple-item-selection/VB/Form1.vb#L25

vb
popupControl.Size = New System.Drawing.Size(500, 300)
ri.PopupControl = popupControl
gridControl2.RepositoryItems.Add(ri)

winforms-grid-use-layoutview-as-master-view/VB/WindowsApplication3/MasterDetailHelper.vb#L107

vb
Dim item As New RepositoryItemPopupContainerEdit()
item.PopupControl = CreatePopupControl()
item.ShowPopupShadow = False

winforms-create-editable-grid-lookup/VB/PopupContainerEditSelection/Form1.vb#L21

vb
popupContainerControl1.Controls.Add(controlNavigator1)
popupContainerEdit1.Properties.PopupControl = popupContainerControl1
popupContainerEdit1.Properties.ShowPopupCloseButton = False

winforms-grid-popupcontaineredit-with-dynamic-content/VB/Q148684/Form1.vb#L42

vb
gridEditor.Dock = DockStyle.Fill
    detailsEdit.PopupControl = New PopupContainerControl()
End Sub

See Also

PopupContainerControl

RepositoryItemPopupContainerEdit Class

RepositoryItemPopupContainerEdit Members

DevExpress.XtraEditors.Repository Namespace