# AutoSuggestBox

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/struct-autosuggestbox/

**struct** · [`ferroui-controls`](/docs/0.5.0/api/ferroui-controls/) · v0.5.0

```rust
struct AutoSuggestBox
```

A text box with a list of suggestions the application supplies (WinUI's `AutoSuggestBox`).

The application listens to `TextChanged`, raised 150 ms after the last change of the text with
its reason, and sets the items (or `ItemsSource`) to the suggestions; the box shows them in a
popup while it has the focus. Choosing a suggestion with the arrow keys or the pointer raises
`SuggestionChosen` (and puts its text, by `TextMemberPath`, in the box when `UpdateTextOnSelect`
is set); Enter, a click of a suggestion and the query button raise `QuerySubmitted`.

The template is the control theme of the WinUI theme (`Controls/AutoSuggestBox.xaml`, from
WinUI's `DefaultAutoSuggestBoxStyle`), with WinUI's parts: the text box `TextBox`, the popup
`SuggestionsPopup` with `SuggestionsContainer` and the list `SuggestionsList`, and the button
`QueryButton`. The Fluent and Simple themes have no template for it
(docs/porting/winui-controls.md, section 5.1).

Missing (docs/porting/winui-controls.md, Input): `AutoMaximizeSuggestionArea`,
`LightDismissOverlayMode`, `TextBoxStyle`, `HeaderPlacement`, the input validation of WinUI and
the placement of the list above the box when there is no room below.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L200)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`text_property`](#function-text_property)
- [`text_member_path_property`](#function-text_member_path_property)
- [`placeholder_text_property`](#function-placeholder_text_property)
- [`update_text_on_select_property`](#function-update_text_on_select_property)
- [`is_suggestion_list_open_property`](#function-is_suggestion_list_open_property)
- [`max_suggestion_list_height_property`](#function-max_suggestion_list_height_property)
- [`query_icon_property`](#function-query_icon_property)
- [`description_property`](#function-description_property)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`text`](#function-text)
- [`set_text`](#function-set_text)
- [`text_member_path`](#function-text_member_path)
- [`set_text_member_path`](#function-set_text_member_path)
- [`placeholder_text`](#function-placeholder_text)
- [`set_placeholder_text`](#function-set_placeholder_text)
- [`update_text_on_select`](#function-update_text_on_select)
- [`set_update_text_on_select`](#function-set_update_text_on_select)
- [`is_suggestion_list_open`](#function-is_suggestion_list_open)
- [`set_is_suggestion_list_open`](#function-set_is_suggestion_list_open)
- [`max_suggestion_list_height`](#function-max_suggestion_list_height)
- [`set_max_suggestion_list_height`](#function-set_max_suggestion_list_height)
- [`query_icon`](#function-query_icon)
- [`set_query_icon`](#function-set_query_icon)
- [`description`](#function-description)
- [`set_description`](#function-set_description)
- [`text_changed`](#function-text_changed)
- [`suggestion_chosen`](#function-suggestion_chosen)
- [`query_submitted`](#function-query_submitted)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L216)

<a id="function-to_ref"></a>

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<AutoSuggestBox>
```

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L216)

<a id="function-text_property"></a>

### text_property

```rust
fn text_property() -> &'static StyledProperty<String>
```

Defines the `Text` property: the text of the box.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L450)

<a id="function-text_member_path_property"></a>

### text_member_path_property

```rust
fn text_member_path_property() -> &'static StyledProperty<String>
```

Defines the `TextMemberPath` property: the path of the text of a chosen suggestion; the
text of the item itself when it is empty (the default).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L450)

<a id="function-placeholder_text_property"></a>

### placeholder_text_property

```rust
fn placeholder_text_property() -> &'static StyledProperty<String>
```

Defines the `PlaceholderText` property: the text shown while the box is empty.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L450)

<a id="function-update_text_on_select_property"></a>

### update_text_on_select_property

```rust
fn update_text_on_select_property() -> &'static StyledProperty<bool>
```

Defines the `UpdateTextOnSelect` property: whether choosing a suggestion puts its text
in the box. `true` by default.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L450)

<a id="function-is_suggestion_list_open_property"></a>

### is_suggestion_list_open_property

```rust
fn is_suggestion_list_open_property() -> &'static StyledProperty<bool>
```

Defines the `IsSuggestionListOpen` property: whether the popup of the suggestions is
open.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L450)

<a id="function-max_suggestion_list_height_property"></a>

### max_suggestion_list_height_property

```rust
fn max_suggestion_list_height_property() -> &'static StyledProperty<f64>
```

Defines the `MaxSuggestionListHeight` property: the largest height of the list of the
suggestions; infinite by default, and a negative value is infinite too.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L450)

<a id="function-query_icon_property"></a>

### query_icon_property

```rust
fn query_icon_property() -> &'static StyledProperty<Option<Ref<IconElement>>>
```

Defines the `QueryIcon` property: the icon of the query button; no button without one
(the default).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L450)

<a id="function-description_property"></a>

### description_property

```rust
fn description_property() -> &'static StyledProperty<Option<BoxedValue>>
```

Defines the `Description` property: the content below the box.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L450)

<a id="function-construct"></a>

### construct

```rust
fn construct() -> Self
```

Creates the class data; see `ferroui_base::FerroObject::construct`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L520)

<a id="function-new"></a>

### new

```rust
fn new() -> Ref<Self>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L538)

<a id="function-text"></a>

### text

```rust
fn text(self: &Self) -> String
```

Gets the text of the box.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L543)

<a id="function-set_text"></a>

### set_text

```rust
fn set_text(self: &Self, value: impl Into<String>)
```

Sets the text of the box.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L548)

<a id="function-text_member_path"></a>

### text_member_path

```rust
fn text_member_path(self: &Self) -> String
```

Gets the path of the text of a chosen suggestion.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L553)

<a id="function-set_text_member_path"></a>

### set_text_member_path

```rust
fn set_text_member_path(self: &Self, value: impl Into<String>)
```

Sets the path of the text of a chosen suggestion.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L558)

<a id="function-placeholder_text"></a>

### placeholder_text

```rust
fn placeholder_text(self: &Self) -> String
```

Gets the text shown while the box is empty.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L563)

<a id="function-set_placeholder_text"></a>

### set_placeholder_text

```rust
fn set_placeholder_text(self: &Self, value: impl Into<String>)
```

Sets the text shown while the box is empty.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L568)

<a id="function-update_text_on_select"></a>

### update_text_on_select

```rust
fn update_text_on_select(self: &Self) -> bool
```

Gets whether choosing a suggestion puts its text in the box.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L573)

<a id="function-set_update_text_on_select"></a>

### set_update_text_on_select

```rust
fn set_update_text_on_select(self: &Self, value: bool)
```

Sets whether choosing a suggestion puts its text in the box.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L578)

<a id="function-is_suggestion_list_open"></a>

### is_suggestion_list_open

```rust
fn is_suggestion_list_open(self: &Self) -> bool
```

Gets whether the popup of the suggestions is open.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L583)

<a id="function-set_is_suggestion_list_open"></a>

### set_is_suggestion_list_open

```rust
fn set_is_suggestion_list_open(self: &Self, value: bool)
```

Opens or closes the popup of the suggestions; opening it focuses the text box.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L588)

<a id="function-max_suggestion_list_height"></a>

### max_suggestion_list_height

```rust
fn max_suggestion_list_height(self: &Self) -> f64
```

Gets the largest height of the list of the suggestions.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L599)

<a id="function-set_max_suggestion_list_height"></a>

### set_max_suggestion_list_height

```rust
fn set_max_suggestion_list_height(self: &Self, value: f64)
```

Sets the largest height of the list of the suggestions.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L604)

<a id="function-query_icon"></a>

### query_icon

```rust
fn query_icon(self: &Self) -> Option<Ref<IconElement>>
```

Gets the icon of the query button.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L609)

<a id="function-set_query_icon"></a>

### set_query_icon

```rust
fn set_query_icon(self: &Self, value: Option<Ref<IconElement>>)
```

Sets the icon of the query button.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L614)

<a id="function-description"></a>

### description

```rust
fn description(self: &Self) -> Option<BoxedValue>
```

Gets the content below the box.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L619)

<a id="function-set_description"></a>

### set_description

```rust
fn set_description(self: &Self, value: Option<BoxedValue>)
```

Sets the content below the box.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L624)

<a id="function-text_changed"></a>

### text_changed

```rust
fn text_changed(self: &Self, handler: impl Fn(&AutoSuggestBoxTextChangedEventArgs) -> () + 'static) -> Subscription
```

Adds a handler of the `TextChanged` event, raised 150 ms after the last change of the text.
Dropping the returned guard removes the handler; `Subscription::detach` keeps it for the
life of the box.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L631)

<a id="function-suggestion_chosen"></a>

### suggestion_chosen

```rust
fn suggestion_chosen(self: &Self, handler: impl Fn(&AutoSuggestBoxSuggestionChosenEventArgs) -> () + 'static) -> Subscription
```

Adds a handler of the `SuggestionChosen` event. Dropping the returned guard removes the
handler; `Subscription::detach` keeps it for the life of the box.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L643)

<a id="function-query_submitted"></a>

### query_submitted

```rust
fn query_submitted(self: &Self, handler: impl Fn(&AutoSuggestBoxQuerySubmittedEventArgs) -> () + 'static) -> Subscription
```

Adds a handler of the `QuerySubmitted` event. Dropping the returned guard removes the
handler; `Subscription::detach` keeps it for the life of the box.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/auto_suggest_box.rs#L658)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`TemplatedControlImplExt`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimplext/)
- [`HeaderedItemsControlImplExt`](/docs/0.5.0/api/ferroui-controls/primitives/trait-headereditemscontrolimplext/)
- [`ControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-controlimplext/)
- [`ItemsControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-itemscontrolimplext/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- [`InputElementImplExt`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimplext/)
- [`InteractiveImplExt`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimplext/)
- [`LayoutableImplExt`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimplext/)
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`StyledElementImplExt`](/docs/0.5.0/api/ferroui-base/trait-styledelementimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- [`VisualImplExt`](/docs/0.5.0/api/ferroui-base/trait-visualimplext/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<AutoSuggestBox>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`VisualImpl`](/docs/0.5.0/api/ferroui-base/trait-visualimpl/)
- [`LayoutableImpl`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimpl/)
- [`InteractiveImpl`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimpl/)
- [`HeaderedItemsControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-headereditemscontrolimpl/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`ControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-controlimpl/)
- [`ItemsControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-itemscontrolimpl/)
- [`InputElementImpl`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimpl/)
- [`TemplatedControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimpl/)
- `Drop`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
