'Declaration Public Event Opening As CancelEventHandler
public event CancelEventHandler Opening
The event handler receives an argument of type CancelEventArgs containing data related to this event. The following CancelEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Cancel |
The Opening event is raised when the Show method is invoked but before the dropdown window is displayed. This event can be used to initialize the PopupControl or adjust the size of the control, since the size of the control will control the size of the popup window.
The event may be cancelled by setting the System.ComponentModel.CancelEventArgs.Cancel property to true. If the event is not cancelled and the PopupControl is specified, the popup window will be displayed and the Opened event will be invoked.
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); }
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