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.v20.1.dll

Declaration

[DXCategory("Events")]
public virtual event CancelEventHandler QueryCloseUp
<DXCategory("Events")>
Public Overridable Event QueryCloseUp As CancelEventHandler

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:

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.

Examples

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