PopupBaseEdit.QueryPopUp Event

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

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v20.1.dll

Declaration

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

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.

Examples

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