Back to Devexpress

AutoSuggestEdit.CustomPopupHighlightedText Event

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

latest2.8 KB
Original Source

AutoSuggestEdit.CustomPopupHighlightedText Event

Occurs when an end-user types into the editor’s text box and allows you to provide a custom text to highlight.

Namespace : DevExpress.Xpf.Editors

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

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public event EventHandler<AutoSuggestEditCustomPopupHighlightedTextEventArgs> CustomPopupHighlightedText
vb
Public Event CustomPopupHighlightedText As EventHandler(Of AutoSuggestEditCustomPopupHighlightedTextEventArgs)

Event Data

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

PropertyDescription
HandledGets or sets whether a text highlight operation is handled and no default processing is required.
TextGets or sets a text to be highlighted.

Remarks

Handle the CustomPopupHighlightedText event to customize the text to highlight. Use the event arguments’ Text property to get the default highlighted text, and to set the custom text.

xaml
<dxe:AutoSuggestEdit 
    ImmediatePopup="True"
    ItemStringFormat="City: {0}"
    ItemsSource="{Binding Cities}"
    PopupHighlightedTextCriteria="StartsWith"
    CustomPopupHighlightedText="AutoSuggestEdit_CustomPopupHighlightedText"/>
csharp
private void AutoSuggestEdit_CustomPopupHighlightedText(object sender, AutoSuggestEditCustomPopupHighlightedTextEventArgs e) {
    e.Text = string.IsNullOrEmpty(e.Text) ? null : "City: " + e.Text;
    e.Handled = true;
}
vb
Private Sub AutoSuggestEdit_CustomPopupHighlightedText(ByVal sender As Object, ByVal e As AutoSuggestEditCustomPopupHighlightedTextEventArgs)
    e.Text = If(String.IsNullOrEmpty(e.Text), Nothing, "City: " & e.Text)
    e.Handled = True
End Sub

See Also

AutoSuggestEdit Class

AutoSuggestEdit Members

DevExpress.Xpf.Editors Namespace