Skip to main content

PopupBaseEdit.QueryPopUp Event

Enables you to specify whether an attempt to open 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 QueryPopUp

Event Data

The QueryPopUp 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 QueryPopUp event is raised when the editor’s popup window is about to be opened. Note: the event fires regardless of whether an attempt is made by the end-user or via code (using the PopupBaseEdit.ShowPopup method). Handle the event when you need to prohibit opening the popup window.

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

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

Example

The following code lists a PopupBaseEdit.QueryPopUp event handler which enables opening the dropdown window only if the user typed the text in the edit box which matches an item in the RepositoryItemComboBox.Items collection.

If the user typed a value which does not exist in the collection, the popup is not opened.

private void comboBoxEdit1_QueryPopUp(object sender, 
  System.ComponentModel.CancelEventArgs e) {
    ComboBoxEdit combo = sender as ComboBoxEdit;
    e.Cancel = combo.Properties.Items.IndexOf(combo.Text) == -1;
}
See Also