RepositoryItemPopupBase.QueryPopUp Event

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

Namespace: DevExpress.XtraEditors.Repository

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 each time the editor's popup window is about to be opened. Handle the event when you want to stop the window from being opened by setting the event's Cancel parameter to true.

An editor's popup window cannot be opened if the editor is disabled or read-only (the RepositoryItem.Enabled property value is false or the RepositoryItem.ReadOnly property value is true).

The current QueryPopUp event is equivalent to the editor's PopupBaseEdit.QueryPopUp event.

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