RepositoryItemPopupBase.QueryCloseUp Event
Enables you to specify whether an attempt to close the editor’s popup window will succeed.
Namespace: DevExpress.XtraEditors.Repository
Assembly: DevExpress.XtraEditors.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
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 each time an attempt is made to close the editor’s popup window. Handle the event to prohibit closing the window, by setting the event’s Cancel parameter to true.
The QueryCloseUp event is raised in the following cases:
- the user has pressed the ESC key, ALT+DOWN ARROW key combination or the key combination specified by the RepositoryItemPopupBase.CloseUpKey property;
- the user has clicked the editor’s box;
- the user has pressed the ENTER key when a particular item within the popup window is selected (for combo boxes, date editors, etc);
- the user has pressed the popup window’s close button. Close buttons are only supported by PopupContainerEdit and CalcEdit editors (see the RepositoryItemPopupContainerEdit.ShowPopupCloseButton and RepositoryItemCalcEdit.ShowCloseButton properties respectively);
- the PopupBaseEdit.ClosePopup or PopupBaseEdit.CancelPopup method has been called.
Note:QueryCloseUp is not raised when you set focus to another control, click outside of the editor’s area or switch to another application. In these cases, you can only specify whether the modifications performed within the popup window should be accepted by the editor. Handle the RepositoryItemPopupBase.CloseUp event for this purpose.
The editor’s PopupBaseEdit.QueryCloseUp event is equivalent to the current event.
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.
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;
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the QueryCloseUp event.
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.