SelectingItemsControl
struct · ferroui-controls · v0.5.0
struct SelectingItemsControl
An ItemsControl that maintains a selection.
SelectingItemsControl provides a base class for ItemsControls
that maintain a selection (single or multiple). By default only its
selected_index and selected_item properties are visible; the current
multiple selection and selected_items together with the
selection_mode properties are protected, however a derived class can
expose these if it wishes to support multiple selection.
SelectingItemsControl maintains a selection respecting the current
selection_mode but it does not react to user input; this must be
handled in a derived class. It does, however, respond to
is_selected_changed_event events from items and updates the selection
accordingly.
Members
TYPEto_refshould_trigger_selectionshould_trigger_selection_keyupdate_selection_from_eventauto_scroll_to_selected_item_propertyselected_index_propertyselected_item_propertyselected_value_propertyselected_value_binding_propertyselected_items_propertyselection_propertyselection_mode_propertyis_selected_propertyis_text_search_enabled_propertyis_selected_changed_eventselection_changed_eventwrap_selection_propertyconstructnewselection_changedauto_scroll_to_selected_itemset_auto_scroll_to_selected_itemselected_indexset_selected_indexselected_itemset_selected_itemselected_value_bindingset_selected_value_bindingselected_valueset_selected_valueselected_itemsset_selected_itemsselectionset_selectionis_text_search_enabledset_is_text_search_enabledwrap_selectionset_wrap_selectionselection_modeset_selection_modealways_selectedget_is_selectedset_is_selectedget_container_from_event_sourceselecting_items_control_from_item_containermove_selectionmove_selection_fromupdate_selectionupdate_selection_for_containerupdate_selection_from_event_source
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<SelectingItemsControl>
Returns a strong reference to this object.
should_trigger_selection
fn should_trigger_selection(self: &Self, selectable: &Visual, event_args: &PointerEventArgs) -> bool
Analyses a pointer event received by a selectable element, and determines whether the action should trigger selection.
should_trigger_selection_key
fn should_trigger_selection_key(self: &Self, selectable: &Visual, event_args: &KeyEventArgs) -> bool
Analyses a key event received by a selectable element, and determines whether the action should trigger selection.
update_selection_from_event
fn update_selection_from_event(self: &Self, container: &Ref<Control>, event_args: &dyn IRoutedEventArgs) -> bool
Updates the selection based on an event that may have originated in a container that belongs to the control.
Returns true if the event originated from a container that belongs to the control and triggered selection; otherwise false.
auto_scroll_to_selected_item_property
fn auto_scroll_to_selected_item_property() -> &'static StyledProperty<bool>
Defines the AutoScrollToSelectedItem property.
selected_index_property
fn selected_index_property() -> &'static DirectProperty<SelectingItemsControl, i32>
Defines the SelectedIndex property.
selected_item_property
fn selected_item_property() -> &'static DirectProperty<SelectingItemsControl, Option<BoxedValue>>
Defines the SelectedItem property.
selected_value_property
fn selected_value_property() -> &'static StyledProperty<Option<BoxedValue>>
Defines the SelectedValue property.
selected_value_binding_property
fn selected_value_binding_property() -> &'static StyledProperty<Option<AssignedBinding>>
Defines the SelectedValueBinding property.
selected_items_property
fn selected_items_property() -> &'static DirectProperty<SelectingItemsControl, Option<SelectedItemsList>>
Defines the SelectedItems property.
selection_property
fn selection_property() -> &'static DirectProperty<SelectingItemsControl, Option<Rc<dyn ISelectionModel>>>
Defines the Selection property.
selection_mode_property
fn selection_mode_property() -> &'static StyledProperty<SelectionMode>
Defines the SelectionMode property.
is_selected_property
fn is_selected_property() -> &'static AttachedProperty<bool>
Defines the IsSelected attached property on a container
Control.
is_text_search_enabled_property
fn is_text_search_enabled_property() -> &'static StyledProperty<bool>
Defines the IsTextSearchEnabled property.
is_selected_changed_event
fn is_selected_changed_event() -> &'static RoutedEvent<RoutedEventArgs>
Event that should be raised by containers when their selection
state changes to notify the parent SelectingItemsControl
that their selection state has changed.
selection_changed_event
fn selection_changed_event() -> &'static RoutedEvent<SelectionChangedEventArgs>
Defines the SelectionChanged event.
wrap_selection_property
fn wrap_selection_property() -> &'static StyledProperty<bool>
Defines the WrapSelection property.
construct
fn construct() -> Self
Creates the class data; see ferroui_base::FerroObject::construct.
new
fn new() -> Ref<Self>
selection_changed
fn selection_changed(self: &Self, handler: impl Fn(&Interactive, &SelectionChangedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
Occurs when the control's selection changes.
auto_scroll_to_selected_item
fn auto_scroll_to_selected_item(self: &Self) -> bool
Gets or sets a value indicating whether to automatically scroll to newly selected items.
set_auto_scroll_to_selected_item
fn set_auto_scroll_to_selected_item(self: &Self, value: bool)
selected_index
fn selected_index(self: &Self) -> i32
Gets or sets the index of the selected item.
set_selected_index
fn set_selected_index(self: &Self, value: i32)
selected_item
fn selected_item(self: &Self) -> Option<BoxedValue>
Gets or sets the selected item.
set_selected_item
fn set_selected_item(self: &Self, value: Option<BoxedValue>)
selected_value_binding
fn selected_value_binding(self: &Self) -> Option<AssignedBinding>
Gets the binding instance which will be used to get the value for
the selected_value property of the selected item.
set_selected_value_binding
fn set_selected_value_binding(self: &Self, value: Option<AssignedBinding>)
selected_value
fn selected_value(self: &Self) -> Option<BoxedValue>
Gets or sets the value of the selected item, obtained using
selected_value_binding.
set_selected_value
fn set_selected_value(self: &Self, value: Option<BoxedValue>)
selected_items
fn selected_items(self: &Self) -> Option<SelectedItemsList>
Gets or sets the selected items.
By default returns a new list that can be manipulated to change the selection. This property can be set to an existing list to keep the selection of the control in sync with it.
set_selected_items
fn set_selected_items(self: &Self, value: Option<SelectedItemsList>)
selection
fn selection(self: &Self) -> Rc<dyn ISelectionModel>
Gets or sets the model that holds the current selection.
set_selection
fn set_selection(self: &Self, value: Option<Rc<dyn ISelectionModel>>)
is_text_search_enabled
fn is_text_search_enabled(self: &Self) -> bool
Gets or sets a value that specifies whether a user can jump to a value by typing.
set_is_text_search_enabled
fn set_is_text_search_enabled(self: &Self, value: bool)
wrap_selection
fn wrap_selection(self: &Self) -> bool
Gets or sets a value which indicates whether to wrap around when the first or last item is reached.
set_wrap_selection
fn set_wrap_selection(self: &Self, value: bool)
selection_mode
fn selection_mode(self: &Self) -> SelectionMode
Gets or sets the selection mode.
Note that the selection mode only applies to selections made via user interaction. Multiple selections can be made programmatically regardless of the value of this property.
set_selection_mode
fn set_selection_mode(self: &Self, value: SelectionMode)
always_selected
fn always_selected(self: &Self) -> bool
Gets a value indicating whether the ALWAYS_SELECTED flag is set.
get_is_selected
fn get_is_selected(control: &Control) -> bool
set_is_selected
fn set_is_selected(control: &Control, value: bool)
Sets the value of the IsSelected attached property on a control.
get_container_from_event_source
fn get_container_from_event_source(self: &Self, event_source: Option<&Ref<Visual>>) -> Option<Ref<Control>>
Tries to get the container that was the source of an event.
Returns the container or None if the event did not originate in a
container.
selecting_items_control_from_item_container
fn selecting_items_control_from_item_container(container: &Ref<Control>) -> Option<Ref<SelectingItemsControl>>
Returns the SelectingItemsControl that owns the specified
container control.
move_selection
fn move_selection(self: &Self, direction: NavigationDirection, wrap: bool, range_modifier: bool) -> bool
Moves the selection in the specified direction relative to the current selection.
Returns true if the selection was moved; otherwise false.
move_selection_from
fn move_selection_from(self: &Self, from: Option<&Ref<Control>>, direction: NavigationDirection, wrap: bool, range_modifier: bool) -> bool
Moves the selection in the specified direction relative to the specified container.
Returns true if the selection was moved; otherwise false.
update_selection
fn update_selection(self: &Self, index: i32, select: bool, range_modifier: bool, toggle_modifier: bool, right_button: bool, from_focus: bool)
Updates the selection for an item based on user interaction.
index is the index of the item, select whether the item should
be selected or unselected, range_modifier whether the range
modifier is enabled (i.e. shift key), toggle_modifier whether the
toggle modifier is enabled (i.e. ctrl key), right_button whether
the event is a right-click and from_focus whether the event is a
focus event.
update_selection_for_container
fn update_selection_for_container(self: &Self, container: &Ref<Control>, select: bool, range_modifier: bool, toggle_modifier: bool, right_button: bool, from_focus: bool)
Updates the selection for a container based on user interaction.
Deprecated. Call update_selection_from_event instead.
update_selection_from_event_source
fn update_selection_from_event_source(self: &Self, event_source: Option<&Ref<Visual>>, select: bool, range_modifier: bool, toggle_modifier: bool, right_button: bool, from_focus: bool) -> bool
Updates the selection based on an event source that may have originated in a container that belongs to the control.
Returns true if the event originated from a container that belongs to the control; otherwise false.
Deprecated. Call update_selection_from_event instead.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeTemplatedControlImplExtSelectingItemsControlImplExtControlImplExtItemsControlImplExtBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyInputElementImplExtInteractiveImplExtLayoutableImplExtFerroObjectImplExtStyledElementImplExtClassDefaultsVisualImplExtErasedDestructorIntoEitherDerefUpcast<T>Upcast<SelectingItemsControl>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleLayoutableImplInteractiveImplControlImplFerroObjectImplStyledElementImplVisualImplInputElementImplTemplatedControlImplItemsControlImplSelectingItemsControlImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.