windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitempopupbase-59f016ea.md
Enables you to specify whether an attempt to close the editor’s popup window will succeed.
Namespace : DevExpress.XtraEditors.Repository
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[DXCategory("Events")]
public virtual event CancelEventHandler QueryCloseUp
<DXCategory("Events")>
Public Overridable Event QueryCloseUp As CancelEventHandler
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. |
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.
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;
}
Private Sub PopupContainerEdit1_QueryCloseUp(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) _
Handles PopupContainerEdit1.QueryCloseUp
If ListBoxControlDest.ItemCount = 0 Then
e.Cancel = True
End If
End Sub
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.
winforms-imagecomboboxedit-disable-specific-items/CS/WindowsApplication33/Form1.cs#L35
imageComboBoxEdit1.Properties.CloseUp += new CloseUpEventHandler(Properties_CloseUp);
imageComboBoxEdit1.Properties.QueryCloseUp += new CancelEventHandler(Properties_QueryCloseUp);
winforms-imagecomboboxedit-disable-specific-items/VB/WindowsApplication33/Form1.vb#L31
AddHandler imageComboBoxEdit1.Properties.CloseUp, New CloseUpEventHandler(AddressOf Properties_CloseUp)
AddHandler imageComboBoxEdit1.Properties.QueryCloseUp, New CancelEventHandler(AddressOf Properties_QueryCloseUp)
Dim i As ImageComboBoxItem = New ImageComboBoxItem()
See Also