Class AutoSuggestBox
Represents a text control that makes suggestions to users as they enter text using a keyboard. The app is notified when text has been changed by the user and is responsible for providing relevant suggestions for this control to display.
[TemplatePart(Name = "PART_TextBox", Type = typeof(TextBox))]
[TemplatePart(Name = "PART_SuggestionsPopup", Type = typeof(Popup))]
[TemplatePart(Name = "PART_SuggestionsList", Type = typeof(ListView))]
public class AutoSuggestBox : ItemsControl, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IQueryAmbient, IAddChild, IContainItemStorage, IIconControl- Inheritance
- 
      
      
      
      
      
      
      
      
      AutoSuggestBox
- Implements
- Inherited Members
Examples
<ui:AutoSuggestBox x:Name="AutoSuggestBox" PlaceholderText="Search">
    <ui:AutoSuggestBox.Icon>
        <ui:IconSourceElement>
            <ui:SymbolIconSource Symbol="Search24" />
        </ui:IconSourceElement>
    </ui:AutoSuggestBox.Icon>
</ui:AutoSuggestBox>Constructors
AutoSuggestBox()
public AutoSuggestBox()Fields
ClearButtonEnabledProperty
Identifies the ClearButtonEnabled dependency property.
public static readonly DependencyProperty ClearButtonEnabledPropertyField Value
ElementSuggestionsList
protected const string ElementSuggestionsList = "PART_SuggestionsList"Field Value
ElementSuggestionsPopup
protected const string ElementSuggestionsPopup = "PART_SuggestionsPopup"Field Value
ElementTextBox
protected const string ElementTextBox = "PART_TextBox"Field Value
FocusCommandProperty
Identifies the FocusCommand dependency property.
public static readonly DependencyProperty FocusCommandPropertyField Value
IconProperty
Identifies the Icon dependency property.
public static readonly DependencyProperty IconPropertyField Value
IsSuggestionListOpenProperty
Identifies the IsSuggestionListOpen dependency property.
public static readonly DependencyProperty IsSuggestionListOpenPropertyField Value
MaxSuggestionListHeightProperty
Identifies the MaxSuggestionListHeight dependency property.
public static readonly DependencyProperty MaxSuggestionListHeightPropertyField Value
OriginalItemsSourceProperty
Identifies the OriginalItemsSource dependency property.
public static readonly DependencyProperty OriginalItemsSourcePropertyField Value
PlaceholderTextProperty
Identifies the PlaceholderText dependency property.
public static readonly DependencyProperty PlaceholderTextPropertyField Value
QuerySubmittedEvent
Identifies the QuerySubmitted routed event.
public static readonly RoutedEvent QuerySubmittedEventField Value
SuggestionChosenEvent
Identifies the SuggestionChosen routed event.
public static readonly RoutedEvent SuggestionChosenEventField Value
TextChangedEvent
Identifies the TextChanged routed event.
public static readonly RoutedEvent TextChangedEventField Value
TextProperty
Identifies the Text dependency property.
public static readonly DependencyProperty TextPropertyField Value
UpdateTextOnSelectProperty
Identifies the UpdateTextOnSelect dependency property.
public static readonly DependencyProperty UpdateTextOnSelectPropertyField Value
Properties
ClearButtonEnabled
Gets or sets a value indicating whether to show the clear button when AutoSuggestBox is focused.
public bool ClearButtonEnabled { get; set; }Property Value
FocusCommand
Gets command used for focusing control.
public ICommand FocusCommand { get; }Property Value
Icon
Gets or sets displayed IconElement.
public IconElement? Icon { get; set; }Property Value
IsSuggestionListOpen
Gets or sets a value indicating whether the drop-down portion of the AutoSuggestBox is open.
public bool IsSuggestionListOpen { get; set; }Property Value
MaxSuggestionListHeight
Gets or sets the maximum height for the drop-down portion of the AutoSuggestBox control.
public double MaxSuggestionListHeight { get; set; }Property Value
OriginalItemsSource
Gets or sets your items here if you want to use the default filtering
public IList OriginalItemsSource { get; set; }Property Value
PlaceholderText
Gets or sets the placeholder text to be displayed in the control.
public string PlaceholderText { get; set; }Property Value
Remarks
The placeholder text to be displayed in the control. The default is an empty string.
SuggestionsList
protected ListView? SuggestionsList { get; set; }Property Value
SuggestionsPopup
protected Popup SuggestionsPopup { get; set; }Property Value
Text
Gets or sets the text that is shown in the control.
public string Text { get; set; }Property Value
Remarks
This property is not typically set in XAML.
TextBox
protected TextBox? TextBox { get; set; }Property Value
UpdateTextOnSelect
Gets or sets a value indicating whether items in the view will trigger an update of the editable text part of the AutoSuggestBox when clicked.
public bool UpdateTextOnSelect { get; set; }Property Value
Methods
AcquireTemplateResources()
protected virtual void AcquireTemplateResources()Focus()
Attempts to set focus to this element.
public bool Focus()Returns
- bool
- true if keyboard focus and logical focus were set to this element; false if only logical focus was set to this element, or if the call to this method did not force the focus to change. 
GetTemplateChild<T>(string)
protected T GetTemplateChild<T>(string name) where T : DependencyObjectParameters
- namestring
Returns
- T
Type Parameters
- T
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().
public override void OnApplyTemplate()OnQuerySubmitted(string)
Method for QuerySubmitted.
protected virtual void OnQuerySubmitted(string queryText)Parameters
- queryTextstring
- Currently submitted query text. 
OnSuggestionChosen(object)
Method for SuggestionChosen.
protected virtual void OnSuggestionChosen(object selectedItem)Parameters
- selectedItemobject
- Currently selected item. 
OnTextChanged(AutoSuggestionBoxTextChangeReason, string)
Method for TextChanged.
protected virtual void OnTextChanged(AutoSuggestionBoxTextChangeReason reason, string text)Parameters
- reasonAutoSuggestionBoxTextChangeReason
- Data for the text changed event. 
- textstring
- Changed text. 
ReleaseTemplateResources()
protected virtual void ReleaseTemplateResources()Events
QuerySubmitted
Occurs when the user submits a search query.
public event TypedEventHandler<AutoSuggestBox, AutoSuggestBoxQuerySubmittedEventArgs> QuerySubmittedEvent Type
SuggestionChosen
Event occurs when the user selects an item from the recommended ones.
public event TypedEventHandler<AutoSuggestBox, AutoSuggestBoxSuggestionChosenEventArgs> SuggestionChosenEvent Type
TextChanged
Raised after the text content of the editable control component is updated.
public event TypedEventHandler<AutoSuggestBox, AutoSuggestBoxTextChangedEventArgs> TextChanged