Skip to main content

PopupBaseEdit.QueryCloseUp Event

Enables you to specify whether an attempt to close the popup window will succeed.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DXCategory("Events")]
public virtual event CancelEventHandler QueryCloseUp

Event Data

The QueryCloseUp event's data class is CancelEventArgs. The following properties provide information specific to this event:

Property Description
Cancel Gets or sets a value indicating whether the event should be canceled.

Remarks

The QueryCloseUp event is raised when the popup window is about to be closed. Note: it is raised regardless whether the attempt is made by the end-user or via the PopupBaseEdit.CancelPopup or PopupBaseEdit.ClosePopup method calls. Handle the event when you need to prevent the editor’s popup window from being closed.

The editor’s QueryCloseUp event is equivalent to the RepositoryItemPopupBase.QueryCloseUp event available via the editor’s Properties property, i.e. adding/removing an event handler for the current event actually affects the RepositoryItemPopupBase.QueryCloseUp event.

Please refer to the RepositoryItemPopupBase.QueryCloseUp event description for more information.

Example

Consider an example of creating a PopupContainerEdit editor which displays two list box controls in the dropdown. The first list box presents all available items. The second listbox displays items chosen from the first one.

PopupBaseEdit_QueryCloseUp_example

Suppose the end-user has to select items in the first list box and copy them (using, say, the ‘>>’ button) to the second list box. The popup window cannot be closed until items are copied. Such behavior is implemented using the PopupBaseEdit.QueryCloseUp event. The following code shows the QueryCloseUp event handler of the popup container editor. This allows for the closing of the popup only if the second list box contains items:

using System.ComponentModel;
private void popupContainerEdit1_QueryCloseUp(object sender, CancelEventArgs e) {
    e.Cancel = listBoxControlDest.ItemCount == 0;
}
See Also