FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    AutoSuggestBox

    struct · ferroui-controls · v0.5.0

    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

    Members

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this class.

    Source

    to_ref

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

    Returns a strong reference to this object.

    Source

    text_property

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

    Defines the Text property: the text of the box.

    Source

    text_member_path_property

    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

    placeholder_text_property

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

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

    Source

    update_text_on_select_property

    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

    is_suggestion_list_open_property

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

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

    Source

    max_suggestion_list_height_property

    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

    query_icon_property

    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

    description_property

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

    Defines the Description property: the content below the box.

    Source

    construct

    fn construct() -> Self
    

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

    Source

    new

    fn new() -> Ref<Self>
    

    Source

    text

    fn text(self: &Self) -> String
    

    Gets the text of the box.

    Source

    set_text

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

    Sets the text of the box.

    Source

    text_member_path

    fn text_member_path(self: &Self) -> String
    

    Gets the path of the text of a chosen suggestion.

    Source

    set_text_member_path

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

    Sets the path of the text of a chosen suggestion.

    Source

    placeholder_text

    fn placeholder_text(self: &Self) -> String
    

    Gets the text shown while the box is empty.

    Source

    set_placeholder_text

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

    Sets the text shown while the box is empty.

    Source

    update_text_on_select

    fn update_text_on_select(self: &Self) -> bool
    

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

    Source

    set_update_text_on_select

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

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

    Source

    is_suggestion_list_open

    fn is_suggestion_list_open(self: &Self) -> bool
    

    Gets whether the popup of the suggestions is open.

    Source

    set_is_suggestion_list_open

    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

    max_suggestion_list_height

    fn max_suggestion_list_height(self: &Self) -> f64
    

    Gets the largest height of the list of the suggestions.

    Source

    set_max_suggestion_list_height

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

    Sets the largest height of the list of the suggestions.

    Source

    query_icon

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

    Gets the icon of the query button.

    Source

    set_query_icon

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

    Sets the icon of the query button.

    Source

    description

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

    Gets the content below the box.

    Source

    set_description

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

    Sets the content below the box.

    Source

    text_changed

    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

    suggestion_chosen

    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

    query_submitted

    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

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.