Back to Devexpress

RepositoryItemPopupBase.QueryPopUp Event

windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitempopupbase.md

latest5.1 KB
Original Source

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.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Events")]
public virtual event CancelEventHandler QueryPopUp
vb
<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:

PropertyDescription
CancelGets 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 current QueryPopUp event is equivalent to the editor’s PopupBaseEdit.QueryPopUp event.

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.

csharp
private void comboBoxEdit1_QueryPopUp(object sender, 
  System.ComponentModel.CancelEventArgs e) {
    ComboBoxEdit combo = sender as ComboBoxEdit;
    e.Cancel = combo.Properties.Items.IndexOf(combo.Text) == -1;
}
vb
Private Sub ComboBoxEdit1_QueryPopUp(ByVal sender As Object, _
  ByVal e As System.ComponentModel.CancelEventArgs) _
  Handles ComboBoxEdit1.QueryPopUp
    Dim combo As ComboBoxEdit = CType(sender, ComboBoxEdit)
    If combo.Properties.Items.IndexOf(combo.Text) = -1 Then
      e.Cancel = True
    End If
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the QueryPopUp 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-grid-use-layoutview-as-master-view/CS/WindowsApplication3/MasterDetailHelper.cs#L101

csharp
item.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor;
item.QueryPopUp += OnPopup;
item.CloseUp += OnCloseUp;

winforms-grid-use-layoutview-as-master-view/VB/WindowsApplication3/MasterDetailHelper.vb#L112

vb
item.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor
AddHandler item.QueryPopUp, AddressOf OnPopup
AddHandler item.CloseUp, AddressOf OnCloseUp

See Also

QueryPopUp

ReadOnly

QueryCloseUp

CloseUp

Popup

BeforePopup

RepositoryItemPopupBase Class

RepositoryItemPopupBase Members

DevExpress.XtraEditors.Repository Namespace