AutoSuggestBox
- Assembly:
Fluence.Wpf - Namespace:
Fluence.Wpf.Controls
public class AutoSuggestBox : Control
A text input control that shows a light-dismiss list of suggestions while the user types, mirroring the WinUI 3 AutoSuggestBox. The application drives filtering by handling TextChanged and updating ItemsSource; the control opens the suggestion list while it has keyboard focus and suggestions exist.
Base type: Control (including inherited WPF and .NET members)
Constructors
AutoSuggestBox
public AutoSuggestBox()
Creates a new AutoSuggestBox instance.
Properties
Header
public object? Header { get; set; }
Gets or sets the optional header content shown above the text box.
IsSuggestionListOpen
public bool IsSuggestionListOpen { get; set; }
Gets or sets whether the suggestion list popup is open. The control opens the list while it has keyboard focus and ItemsSource has items, and closes it on light dismiss, focus loss, Escape, or query submission.
ItemsSource
public IEnumerable? ItemsSource { get; set; }
Gets or sets the collection of suggestions shown in the suggestion list. Replace this collection from a TextChanged handler to filter suggestions as the user types.
MaxSuggestionListHeight
public double MaxSuggestionListHeight { get; set; }
Gets or sets the maximum height of the suggestion list popup.
PlaceholderText
public string PlaceholderText { get; set; }
Gets or sets the placeholder text displayed when the text box is empty.
QueryIcon
public object? QueryIcon { get; set; }
Gets or sets the icon shown at the right edge of the text box, typically a search glyph. The default template hosts it in a clickable subtle button in the text box icon slot; clicking it submits the current text through the same QuerySubmitted pipeline as the Enter key. No button is shown while the value is null.
Text
public string Text { get; set; }
Gets or sets the text shown in the text box portion of the control. Setting this property programmatically raises TextChanged with ProgrammaticChange.
TextMemberPath
public string TextMemberPath { get; set; }
Gets or sets the property path on a suggestion item that supplies the display text and, when UpdateTextOnSelect is enabled, the value written into Text when the suggestion is chosen. When empty, the item's string representation is used.
UpdateTextOnSelect
public bool UpdateTextOnSelect { get; set; }
Gets or sets whether choosing a suggestion updates Text with the value resolved through TextMemberPath.
Methods
OnApplyTemplate
public override void OnApplyTemplate()
Documentation inherited from the Control API.
OnCreateAutomationPeer
protected override AutomationPeer OnCreateAutomationPeer()
Documentation inherited from the Control API.
OnGotKeyboardFocus
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
Documentation inherited from the Control API.
OnIsKeyboardFocusWithinChanged
protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e)
Documentation inherited from the Control API.
OnPreviewKeyDown
protected override void OnPreviewKeyDown(KeyEventArgs e)
Documentation inherited from the Control API.
Events
QuerySubmitted
public event EventHandler<AutoSuggestBoxQuerySubmittedEventArgs>? QuerySubmitted
Occurs when the user submits a query with the Enter key or by choosing a suggestion from the suggestion list.
SuggestionChosen
public event EventHandler<AutoSuggestBoxSuggestionChosenEventArgs>? SuggestionChosen
Occurs when the user chooses a suggestion from the suggestion list, before Text is updated and QuerySubmitted is raised.
TextChanged
public event EventHandler<AutoSuggestBoxTextChangedEventArgs>? TextChanged
Occurs after the text changes. Inspect Reason to distinguish user input, programmatic changes, and suggestion-driven updates.
Dependency property identifiers
Use these identifiers with WPF property APIs. The matching CLR properties appear above when the control exposes them.
HeaderProperty
public static readonly DependencyProperty HeaderProperty
Identifies the Header dependency property.
IsSuggestionListOpenProperty
public static readonly DependencyProperty IsSuggestionListOpenProperty
Identifies the IsSuggestionListOpen dependency property.
ItemsSourceProperty
public static readonly DependencyProperty ItemsSourceProperty
Identifies the ItemsSource dependency property.
MaxSuggestionListHeightProperty
public static readonly DependencyProperty MaxSuggestionListHeightProperty
Identifies the MaxSuggestionListHeight dependency property.
PlaceholderTextProperty
public static readonly DependencyProperty PlaceholderTextProperty
Identifies the PlaceholderText dependency property.
QueryIconProperty
public static readonly DependencyProperty QueryIconProperty
Identifies the QueryIcon dependency property.
TextMemberPathProperty
public static readonly DependencyProperty TextMemberPathProperty
Identifies the TextMemberPath dependency property.
TextProperty
public static readonly DependencyProperty TextProperty
Identifies the Text dependency property.
UpdateTextOnSelectProperty
public static readonly DependencyProperty UpdateTextOnSelectProperty
Identifies the UpdateTextOnSelect dependency property.