Back to Devexpress

AutoSuggestEdit.QuerySubmitted Event

wpf-devexpress-dot-xpf-dot-editors-dot-autosuggestedit-86a22e6d.md

latest4.1 KB
Original Source

AutoSuggestEdit.QuerySubmitted Event

Fires when the editor’s text has been changed and allows you to provide any relevant suggestions that would be displayed in the editor’s popup window.

Namespace : DevExpress.Xpf.Editors

Assembly : DevExpress.Xpf.Core.v25.2.dll

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public event EventHandler<AutoSuggestEditQuerySubmittedEventArgs> QuerySubmitted
vb
Public Event QuerySubmitted As EventHandler(Of AutoSuggestEditQuerySubmittedEventArgs)

Event Data

The QuerySubmitted event's data class is AutoSuggestEditQuerySubmittedEventArgs. The following properties provide information specific to this event:

PropertyDescription
TextGets the text entered by an end user.

Remarks

Handle the QuerySubmitted event to provide the AutoSuggestEdit with the suggestions that should be displayed in the editor’s popup window.

Use the event handler’s Text property to get the text currently entered by an end user.

Example

xaml
<dxe:AutoSuggestEdit
    QuerySubmitted="AutoSuggestEdit_QuerySubmitted">
</dxe:AutoSuggestEdit>
csharp
private void AutoSuggestEdit_QuerySubmitted(object sender, DevExpress.Xpf.Editors.AutoSuggestEditQuerySubmittedEventArgs e) {
    ((AutoSuggestEdit)sender).ItemsSource = string.IsNullOrEmpty(e.Text)
? null
: Customer.GetCustomers()
      .Where(x => Regex.IsMatch(x.City, Regex.Escape(e.Text), RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace))
      .Take(10)
      .ToList();
}
vb
Private Sub AutoSuggestEdit_QuerySubmitted(ByVal sender As Object, ByVal e As DevExpress.Xpf.Editors.AutoSuggestEditQuerySubmittedEventArgs)
    (CType(sender, AutoSuggestEdit)).ItemsSource = If(String.IsNullOrEmpty(e.Text), Nothing, Customer.GetCustomers().Where(Function(x) Regex.IsMatch(x.City, Regex.Escape(e.Text), RegexOptions.IgnoreCase Or RegexOptions.IgnorePatternWhitespace)).Take(10).ToList())
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the QuerySubmitted 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.

wpf-data-grid-use-autosuggesteditsettings/CS/MainWindow.xaml.cs#L25

csharp
if (ActiveEditor != null)
        ActiveEditor.QuerySubmitted += QuerySubmitted;
}

wpf-data-grid-use-autosuggesteditsettings/VB/MainWindow.xaml.vb#L26

vb
ActiveEditor = TryCast(e.Editor, AutoSuggestEdit)
    If ActiveEditor IsNot Nothing Then AddHandler ActiveEditor.QuerySubmitted, AddressOf QuerySubmitted
End Sub

See Also

AutoSuggestEdit Class

AutoSuggestEdit Members

DevExpress.Xpf.Editors Namespace