AutoCompleteBox
struct · ferroui-controls · v0.5.0
struct AutoCompleteBox
Represents a control that provides a text box for user input and a drop-down that contains possible matches based on the input in the text box.
Members
TYPEto_refget_selection_adapter_parton_populatingon_populatedon_selection_changedon_drop_down_openingon_drop_down_openedon_drop_down_closingon_drop_down_closedon_text_changedformat_valuecaret_index_propertyplaceholder_text_propertyplaceholder_foreground_propertyminimum_prefix_length_propertyminimum_populate_delay_propertymax_drop_down_height_propertyis_text_completion_enabled_propertyitem_template_propertyclear_selection_on_lost_focus_propertyis_drop_down_open_propertyselected_item_propertytext_propertysearch_text_propertyfilter_mode_propertyitem_filter_propertytext_filter_propertyitem_selector_propertytext_selector_propertyitems_source_propertyasync_populator_propertymax_length_propertyinner_left_content_propertyinner_right_content_propertyvalue_member_binding_propertywatermark_propertywatermark_foreground_propertyselection_changed_eventquery_submitted_eventtext_changed_eventconstructnewcaret_indexset_caret_indexminimum_prefix_lengthset_minimum_prefix_lengthis_text_completion_enabledset_is_text_completion_enableditem_templateset_item_templateminimum_populate_delayset_minimum_populate_delaymax_drop_down_heightset_max_drop_down_heightis_drop_down_openset_is_drop_down_openclear_selection_on_lost_focusset_clear_selection_on_lost_focusvalue_member_bindingset_value_member_bindingselected_itemset_selected_itemtextset_textsearch_textfilter_modeset_filter_modeplaceholder_textset_placeholder_textwatermarkset_watermarkplaceholder_foregroundset_placeholder_foregroundwatermark_foregroundset_watermark_foregrounditem_filterset_item_filtertext_filterset_text_filteritem_selectorset_item_selectortext_selectorset_text_selectorasync_populatorset_async_populatoritems_sourceset_items_sourcemax_lengthset_max_lengthinner_left_contentset_inner_left_contentinner_right_contentset_inner_right_contentselection_adapterset_selection_adapterhas_focusquery_submittedtext_changedpopulatingpopulateddrop_down_openingdrop_down_openeddrop_down_closingdrop_down_closedselection_changedpopulate_complete
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<AutoCompleteBox>
Returns a strong reference to this object.
get_selection_adapter_part
fn get_selection_adapter_part(self: &Self, name_scope: &NameScopeRef) -> Option<Rc<dyn ISelectionAdapter>>
Returns the ISelectionAdapter part, if possible. Otherwise,
None.
on_populating
fn on_populating(self: &Self, e: &PopulatingEventArgs)
Raises the Populating event.
on_populated
fn on_populated(self: &Self, e: &PopulatedEventArgs)
Raises the Populated event.
on_selection_changed
fn on_selection_changed(self: &Self, e: &SelectionChangedEventArgs)
Raises the SelectionChanged event.
on_drop_down_opening
fn on_drop_down_opening(self: &Self, e: &CancelEventArgs)
Raises the DropDownOpening event.
on_drop_down_opened
fn on_drop_down_opened(self: &Self)
Raises the DropDownOpened event.
on_drop_down_closing
fn on_drop_down_closing(self: &Self, e: &CancelEventArgs)
Raises the DropDownClosing event.
on_drop_down_closed
fn on_drop_down_closed(self: &Self)
Raises the DropDownClosed event.
on_text_changed
fn on_text_changed(self: &Self, e: &TextChangedEventArgs)
Raises the TextChanged event.
format_value
fn format_value(self: &Self, value: &Option<BoxedValue>) -> Option<String>
Converts the specified object to a string by using the binding
specified by the ValueMemberBinding property.
Override this method to provide a custom string conversion.
caret_index_property
fn caret_index_property() -> &'static StyledProperty<i32>
Defines the CaretIndex property.
placeholder_text_property
fn placeholder_text_property() -> &'static StyledProperty<Option<String>>
Defines the PlaceholderText property.
placeholder_foreground_property
fn placeholder_foreground_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
Defines the PlaceholderForeground property.
minimum_prefix_length_property
fn minimum_prefix_length_property() -> &'static StyledProperty<i32>
Identifies the MinimumPrefixLength property.
minimum_populate_delay_property
fn minimum_populate_delay_property() -> &'static StyledProperty<Duration>
Identifies the MinimumPopulateDelay property.
A Duration: a negative delay, which the reference refuses in its validation
(IsValidMinimumPopulateDelay), is not a value of the type.
max_drop_down_height_property
fn max_drop_down_height_property() -> &'static StyledProperty<f64>
Identifies the MaxDropDownHeight property.
is_text_completion_enabled_property
fn is_text_completion_enabled_property() -> &'static StyledProperty<bool>
Identifies the IsTextCompletionEnabled property.
item_template_property
fn item_template_property() -> &'static StyledProperty<Option<Rc<dyn IDataTemplate>>>
Identifies the ItemTemplate property.
clear_selection_on_lost_focus_property
fn clear_selection_on_lost_focus_property() -> &'static StyledProperty<bool>
Defines the ClearSelectionOnLostFocus property.
is_drop_down_open_property
fn is_drop_down_open_property() -> &'static StyledProperty<bool>
Identifies the IsDropDownOpen property.
selected_item_property
fn selected_item_property() -> &'static StyledProperty<Option<BoxedValue>>
Identifies the SelectedItem property.
text_property
fn text_property() -> &'static StyledProperty<Option<String>>
Identifies the Text property.
search_text_property
fn search_text_property() -> &'static DirectProperty<AutoCompleteBox, Option<String>>
Identifies the SearchText property.
filter_mode_property
fn filter_mode_property() -> &'static StyledProperty<AutoCompleteFilterMode>
Gets the identifier for the FilterMode property.
item_filter_property
fn item_filter_property() -> &'static StyledProperty<Option<AutoCompleteFilterPredicate<Option<BoxedValue>>>>
Identifies the ItemFilter property.
text_filter_property
fn text_filter_property() -> &'static StyledProperty<Option<AutoCompleteFilterPredicate<Option<String>>>>
Identifies the TextFilter property.
item_selector_property
fn item_selector_property() -> &'static StyledProperty<Option<AutoCompleteSelector<BoxedValue>>>
Identifies the ItemSelector property.
text_selector_property
fn text_selector_property() -> &'static StyledProperty<Option<AutoCompleteSelector<Option<String>>>>
Identifies the TextSelector property.
items_source_property
fn items_source_property() -> &'static StyledProperty<Option<ItemsSource>>
Identifies the ItemsSource property.
async_populator_property
fn async_populator_property() -> &'static StyledProperty<Option<AutoCompleteAsyncPopulator>>
Identifies the AsyncPopulator property.
max_length_property
fn max_length_property() -> &'static StyledProperty<i32>
Defines the MaxLength property.
inner_left_content_property
fn inner_left_content_property() -> &'static StyledProperty<Option<BoxedValue>>
Defines the InnerLeftContent property.
inner_right_content_property
fn inner_right_content_property() -> &'static StyledProperty<Option<BoxedValue>>
Defines the InnerRightContent property.
value_member_binding_property
fn value_member_binding_property() -> &'static StyledProperty<Option<AssignedBinding>>
Defines the ValueMemberBinding property.
watermark_property
fn watermark_property() -> &'static StyledProperty<Option<String>>
Defines the Watermark property.
Deprecated. Use placeholder_text_property instead.
watermark_foreground_property
fn watermark_foreground_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
Defines the WatermarkForeground property.
Deprecated. Use placeholder_foreground_property instead.
selection_changed_event
fn selection_changed_event() -> &'static RoutedEvent<SelectionChangedEventArgs>
Defines the SelectionChanged event.
query_submitted_event
fn query_submitted_event() -> &'static RoutedEvent<AutoCompleteBoxQuerySubmittedEventArgs>
Defines the QuerySubmitted event: a FerroUI addition after WinUI's
AutoSuggestBox.QuerySubmitted, raised when Enter submits the text of the box.
text_changed_event
fn text_changed_event() -> &'static RoutedEvent<TextChangedEventArgs>
Defines the TextChanged event.
construct
fn construct() -> Self
Creates the class data; see ferroui_base::FerroObject::construct.
new
fn new() -> Ref<Self>
Initializes a new instance of the AutoCompleteBox class.
caret_index
fn caret_index(self: &Self) -> i32
Gets or sets the caret index.
set_caret_index
fn set_caret_index(self: &Self, value: i32)
minimum_prefix_length
fn minimum_prefix_length(self: &Self) -> i32
Gets or sets the minimum number of characters required to be entered
in the text box before the AutoCompleteBox displays possible
matches. The default is 1.
If you set MinimumPrefixLength to -1, the control will not provide
possible matches. There is no maximum value, but setting it to a
value that is too large will prevent the control from providing
possible matches as well.
set_minimum_prefix_length
fn set_minimum_prefix_length(self: &Self, value: i32)
is_text_completion_enabled
fn is_text_completion_enabled(self: &Self) -> bool
Gets or sets a value indicating whether the first possible match
found during the filtering process will be displayed automatically
in the text box. The default is false.
set_is_text_completion_enabled
fn set_is_text_completion_enabled(self: &Self, value: bool)
item_template
fn item_template(self: &Self) -> Option<Rc<dyn IDataTemplate>>
Gets or sets the data template that is used to display the items in
the drop-down portion of the AutoCompleteBox control.
set_item_template
fn set_item_template(self: &Self, value: Option<Rc<dyn IDataTemplate>>)
minimum_populate_delay
fn minimum_populate_delay(self: &Self) -> Duration
Gets or sets the minimum delay after text is typed in the text box before the control populates the list of possible matches in the drop-down. The default is zero.
set_minimum_populate_delay
fn set_minimum_populate_delay(self: &Self, value: Duration)
max_drop_down_height
fn max_drop_down_height(self: &Self) -> f64
Gets or sets the maximum height of the drop-down portion of the
AutoCompleteBox control. The default is infinity.
set_max_drop_down_height
fn set_max_drop_down_height(self: &Self, value: f64)
is_drop_down_open
fn is_drop_down_open(self: &Self) -> bool
Gets or sets a value indicating whether the drop-down portion of the control is open.
set_is_drop_down_open
fn set_is_drop_down_open(self: &Self, value: bool)
clear_selection_on_lost_focus
fn clear_selection_on_lost_focus(self: &Self) -> bool
Gets or sets a value that determines whether the control clears its selection after it loses focus.
set_clear_selection_on_lost_focus
fn set_clear_selection_on_lost_focus(self: &Self, value: bool)
value_member_binding
fn value_member_binding(self: &Self) -> Option<AssignedBinding>
Gets or sets the binding that is used to get the values for display
in the text box portion of the AutoCompleteBox control, and to
filter items for display in the drop-down.
set_value_member_binding
fn set_value_member_binding(self: &Self, value: Option<AssignedBinding>)
selected_item
fn selected_item(self: &Self) -> Option<BoxedValue>
Gets or sets the selected item in the drop-down. The default is
None.
If the IsTextCompletionEnabled property is true and text typed
by the user matches an item in the ItemsSource collection, which
is then displayed in the text box, the SelectedItem property will
be a null reference.
set_selected_item
fn set_selected_item(self: &Self, value: Option<BoxedValue>)
text
fn text(self: &Self) -> Option<String>
Gets or sets the text in the text box portion of the
AutoCompleteBox control.
set_text
fn set_text(self: &Self, value: Option<&str>)
search_text
fn search_text(self: &Self) -> Option<String>
Gets the text that is used to filter items in the ItemsSource item
collection.
The search text value is typically the same as the Text property,
but is set after the text changed event occurs and before the
Populating event.
filter_mode
fn filter_mode(self: &Self) -> AutoCompleteFilterMode
Gets or sets how the text in the text box is used to filter items
specified by the ItemsSource property for display in the
drop-down. The default is AutoCompleteFilterMode::StartsWith.
Use the FilterMode property to specify how possible matches are
filtered. For example, possible matches can be filtered in a
predefined or custom way. FilterMode is automatically set to
Custom if you set the ItemFilter property.
set_filter_mode
fn set_filter_mode(self: &Self, value: AutoCompleteFilterMode)
placeholder_text
fn placeholder_text(self: &Self) -> Option<String>
Gets or sets the placeholder or descriptive text that is displayed
even if the Text property is not yet set.
set_placeholder_text
fn set_placeholder_text(self: &Self, value: Option<&str>)
watermark
fn watermark(self: &Self) -> Option<String>
Gets or sets the placeholder or descriptive text that is displayed
even if the Text property is not yet set.
Deprecated. Use placeholder_text instead.
set_watermark
fn set_watermark(self: &Self, value: Option<&str>)
Deprecated. Use set_placeholder_text instead.
placeholder_foreground
fn placeholder_foreground(self: &Self) -> Option<Rc<dyn IBrush>>
Gets or sets the brush used for the foreground color of the placeholder text.
set_placeholder_foreground
fn set_placeholder_foreground(self: &Self, value: Option<Rc<dyn IBrush>>)
watermark_foreground
fn watermark_foreground(self: &Self) -> Option<Rc<dyn IBrush>>
Gets or sets the brush used for the foreground color of the placeholder text.
Deprecated. Use placeholder_foreground instead.
set_watermark_foreground
fn set_watermark_foreground(self: &Self, value: Option<Rc<dyn IBrush>>)
Deprecated. Use set_placeholder_foreground instead.
item_filter
fn item_filter(self: &Self) -> Option<AutoCompleteFilterPredicate<Option<BoxedValue>>>
Gets or sets the custom method that uses user-entered text to filter
the items specified by the ItemsSource property for display in the
drop-down. The default is None.
The filter mode is automatically set to Custom if you set the
ItemFilter property.
set_item_filter
fn set_item_filter(self: &Self, value: Option<AutoCompleteFilterPredicate<Option<BoxedValue>>>)
text_filter
fn text_filter(self: &Self) -> Option<AutoCompleteFilterPredicate<Option<String>>>
Gets or sets the custom method that uses the user-entered text to
filter items specified by the ItemsSource property in a text-based
way for display in the drop-down.
The search mode is automatically set to Custom if you set the
TextFilter property.
set_text_filter
fn set_text_filter(self: &Self, value: Option<AutoCompleteFilterPredicate<Option<String>>>)
item_selector
fn item_selector(self: &Self) -> Option<AutoCompleteSelector<BoxedValue>>
Gets or sets the custom method that combines the user-entered text
and one of the items specified by the ItemsSource.
set_item_selector
fn set_item_selector(self: &Self, value: Option<AutoCompleteSelector<BoxedValue>>)
text_selector
fn text_selector(self: &Self) -> Option<AutoCompleteSelector<Option<String>>>
Gets or sets the custom method that combines the user-entered text
and one of the items specified by the ItemsSource in a text-based
way.
set_text_selector
fn set_text_selector(self: &Self, value: Option<AutoCompleteSelector<Option<String>>>)
async_populator
fn async_populator(self: &Self) -> Option<AutoCompleteAsyncPopulator>
Gets or sets the asynchronous populator of the drop-down.
set_async_populator
fn set_async_populator(self: &Self, value: Option<AutoCompleteAsyncPopulator>)
items_source
fn items_source(self: &Self) -> Option<ItemsSource>
Gets or sets a collection that is used to generate the items for the
drop-down portion of the AutoCompleteBox control.
set_items_source
fn set_items_source(self: &Self, value: Option<ItemsSource>)
max_length
fn max_length(self: &Self) -> i32
Gets or sets the maximum number of characters that the
AutoCompleteBox can accept. This constraint only applies for
manually entered (user-inputted) text.
set_max_length
fn set_max_length(self: &Self, value: i32)
inner_left_content
fn inner_left_content(self: &Self) -> Option<BoxedValue>
Gets or sets custom content that is positioned on the left side of the text layout box.
set_inner_left_content
fn set_inner_left_content(self: &Self, value: Option<BoxedValue>)
inner_right_content
fn inner_right_content(self: &Self) -> Option<BoxedValue>
Gets or sets custom content that is positioned on the right side of the text layout box.
set_inner_right_content
fn set_inner_right_content(self: &Self, value: Option<BoxedValue>)
selection_adapter
fn selection_adapter(self: &Self) -> Option<Rc<dyn ISelectionAdapter>>
Gets the selection adapter used to populate the drop-down with a list of selectable items.
You can use this property when you create an automation peer to use
with the control or deriving from AutoCompleteBox to create a
custom control.
set_selection_adapter
fn set_selection_adapter(self: &Self, value: Option<Rc<dyn ISelectionAdapter>>)
Sets the selection adapter used to populate the drop-down with a list of selectable items.
has_focus
fn has_focus(self: &Self) -> bool
Determines whether the text box or drop-down portion of the
AutoCompleteBox control has focus.
Deprecated. Use is_keyboard_focus_within instead.
query_submitted
fn query_submitted(self: &Self, handler: impl Fn(&Interactive, &AutoCompleteBoxQuerySubmittedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
Occurs when Enter submits the text of the box (a WinUI addition, see
query_submitted_event).
text_changed
fn text_changed(self: &Self, handler: impl Fn(&Interactive, &TextChangedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
Occurs asynchronously when the text in the text box portion of the
AutoCompleteBox changes.
populating
fn populating(self: &Self, handler: impl Fn(&PopulatingEventArgs) -> () + 'static) -> Subscription
Occurs when the AutoCompleteBox is populating the drop-down with
possible matches based on the Text property.
If the event is cancelled, by setting the cancel flag of the args, the control will not automatically populate the selection adapter contained in the drop-down. In this case, if you want possible matches to appear, you must provide the logic for populating the selection adapter.
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the box.
populated
fn populated(self: &Self, handler: impl Fn(&PopulatedEventArgs) -> () + 'static) -> Subscription
Occurs when the AutoCompleteBox has populated the drop-down with
possible matches based on the Text property.
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the box.
drop_down_opening
fn drop_down_opening(self: &Self, handler: impl Fn(&CancelEventArgs) -> () + 'static) -> Subscription
Occurs when the value of the IsDropDownOpen property is changing
from false to true.
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the box.
drop_down_opened
fn drop_down_opened(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
Occurs when the value of the IsDropDownOpen property has changed
from false to true and the drop-down is open.
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the box.
drop_down_closing
fn drop_down_closing(self: &Self, handler: impl Fn(&CancelEventArgs) -> () + 'static) -> Subscription
Occurs when the IsDropDownOpen property is changing from true to
false.
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the box.
drop_down_closed
fn drop_down_closed(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
Occurs when the IsDropDownOpen property was changed from true to
false and the drop-down is open.
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the box.
selection_changed
fn selection_changed(self: &Self, handler: impl Fn(&Interactive, &SelectionChangedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
Occurs when the selected item in the drop-down portion of the
AutoCompleteBox has changed.
populate_complete
fn populate_complete(self: &Self)
Notifies the AutoCompleteBox that the ItemsSource property has
been set and the data can be filtered to provide possible matches in
the drop-down.
Call this method when you are providing custom population of the
drop-down portion of the control, to signal the control that you are
done with the population process. Typically, you use it when the
population process is a long-running process and you want to cancel
built-in filtering of the ItemsSource items. In this case, you can
handle the Populating event and set the cancel flag of its args.
When the long-running process has completed you call
populate_complete to indicate the drop-down is populated.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeTemplatedControlImplExtControlImplExtAutoCompleteBoxImplExtBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyInputElementImplExtInteractiveImplExtLayoutableImplExtFerroObjectImplExtStyledElementImplExtClassDefaultsVisualImplExtErasedDestructorIntoEitherDerefUpcast<T>Upcast<AutoCompleteBox>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleStyledElementImplVisualImplLayoutableImplInteractiveImplControlImplFerroObjectImplInputElementImplTemplatedControlImplAutoCompleteBoxImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.