New to Telerik UI for WinForms? Download free 30-day trial

PopupManager

The PopupManager class manages all opened popups in your application per UI thread.

Properties

Property Description
Hooked Gets a value indicating whether the popup manager has hooks installed.
ClosePopupOnMouseWheel Gets or Sets a value indicating whether the popups will stop closing on MouseWheel.
PopupCount Gets the count of the IPopupControl instances currently registered in the PopupManager.
LastActivatedPopup Getst the popup which was last activated.
Default A static property that gets the only instance of the PopupManager class. Other instances can not be created.

Methods

Method Description
AddPopup(IPopupControl form) Adds a popup form to the popups of the PopupManager and registers a message hook if the form provided is the first one.
RemovePopup(IPopupControl form) Removes the provided popup from the popups of the PopupManager and unregisters the message hook if there are no more popups.
ClosePopup(IPopupControl popup) Attempts to close an Telerik.WinControls.UI.IPopupControl implementation.
CloseAll(RadPopupCloseReason reason) Closes all popups managed by the PopupManager.
CloseAllToRoot(RadPopupCloseReason reason, IPopupControl leaf) Closes all popups from a leaf to the root.
ContainsPopup(IPopupControl form) Checks if the PopupManager monitors the provided popup.

Example

All popup menus in the Telerik UI for WinForms suite are managed by a PopupManager which internally uses an IMessageListener for the messages. You can disable the PopupManager to handle the popup menu by removing the popup from class. The following solution shows how to remove a certain drop down from the PopupManager's default mouse handling by calling the PopupManager.Default.RemovePopup(your drop-down menu).


public void DoSomething()
{
    this.radDropDownButton1.DropDownOpened += RadDropDownButton1_DropDownOpened;
}

private void RadDropDownButton1_DropDownOpened(object sender, EventArgs e)
{
   PopupManager.Default.RemovePopup(this.radDropDownButton1.DropDownButtonElement.DropDownMenu);
}


Public Sub DoSomething()
    AddHandler Me.radDropDownButton1.DropDownOpened, AddressOf RadDropDownButton1_DropDownOpened
End Sub

Private Sub RadDropDownButton1_DropDownOpened(ByVal sender As Object, ByVal e As EventArgs)
    PopupManager.Default.RemovePopup(Me.radDropDownButton1.DropDownButtonElement.DropDownMenu)
End Sub

The suggested above approach will need to be applied for each of the nested menu item's drop-down. Also, it would be necessary to take care of closing the popups, e.g. when an item is clicked.

See Also

In this article