Version

PopupControl Property

Returns or sets the control that will be displayed in the popup.
Syntax
'Declaration
 
Public Property PopupControl As Control
public Control PopupControl {get; set;}
Remarks

The PopupControl is the control that will be displayed in the popup window when the Show method is invoked.

Note Attempting to set the property while the popup window is displayed (see IsDisplayed) will result in an exception.

Example
The following sample demonstrates using the Opening event of the UltraPopupControlContainer to set and initialize the control that will be displayed in the popup window.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.Misc

Private Sub ultraPopupControlContainer1_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ultraPopupControlContainer1.Opening
    Dim popup As UltraPopupControlContainer = CType(sender, UltraPopupControlContainer)

    Dim tree As TreeView = Me.treeList

    ' the control that will be displayed can be initialized here
    If Not popup.PopupControl Is tree Then
        popup.PopupControl = tree
    End If

    ' this Opening event will normally be used to initialize
    ' the control that will be dropped down
    Me.InitializeDropDownTree(tree)
End Sub

Private Sub InitializeDropDownTree(ByVal tree As TreeView)
    ' initialize the tree that we will be dropping down
    ' clear any existing nodes
    tree.Nodes.Clear()

    ' allow for full row selection
    tree.FullRowSelect = True
    tree.ShowLines = False
    tree.ShowRootLines = False

    ' only show a single border
    tree.BorderStyle = BorderStyle.FixedSingle

    ' create the nodes
    tree.Nodes.Add("New")
    tree.Nodes.Add("Open Existing")
    tree.Nodes.Add("Open Recent")

    ' select the first node
    tree.SelectedNode = tree.Nodes(0)

    ' size the control so it shows all the nodes
    Dim top As Integer = tree.Nodes(0).Bounds.Top
    Dim bottom As Integer = tree.Nodes(tree.Nodes.Count - 1).Bounds.Bottom
    tree.ClientSize = New Size(tree.ClientSize.Width, bottom - top)
End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.Misc;

private void ultraPopupControlContainer1_Opening(object sender, System.ComponentModel.CancelEventArgs e)
{
	UltraPopupControlContainer popup = sender as UltraPopupControlContainer;

	TreeView tree = this.treeList;

	// the control that will be displayed can be initialized here
	if (popup.PopupControl != tree)
		popup.PopupControl = tree;

	// this Opening event will normally be used to initialize
	// the control that will be dropped down
	this.InitializeDropDownTree(tree);
}

private void InitializeDropDownTree(TreeView tree)
{
	// initialize the tree that we will be dropping down
	// clear any existing nodes
	tree.Nodes.Clear();

	// allow for full row selection
	tree.FullRowSelect = true;
	tree.ShowLines = false;
	tree.ShowRootLines = false;

	// only show a single border
	tree.BorderStyle = BorderStyle.FixedSingle;

	// create the nodes
	tree.Nodes.Add("New");
	tree.Nodes.Add("Open Existing");
	tree.Nodes.Add("Open Recent");

	// select the first node
	tree.SelectedNode = tree.Nodes[0];

	// size the control so it shows all the nodes
	int top = tree.Nodes[0].Bounds.Top;
	int bottom = tree.Nodes[tree.Nodes.Count - 1].Bounds.Bottom;
	tree.ClientSize = new Size(tree.ClientSize.Width, bottom - top);

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also