ItemsControl
struct · ferroui-controls · v0.5.0
struct ItemsControl
Displays a collection of items.
Members
TYPEto_refcreate_container_for_item_overrideprepare_container_for_item_overridecontainer_for_item_prepared_overridecontainer_index_changed_overrideclear_container_for_item_overrideneeds_container_overrideon_items_view_collection_changedPSEUDO_CLASSESitem_container_theme_propertyitem_count_propertyitems_panel_propertyitems_source_propertyitem_template_propertydisplay_member_binding_propertyconstructnewdisplay_member_bindingset_display_member_bindingitem_container_generatoritemsitem_container_themeset_item_container_themeitem_countitems_panelset_items_panelitems_sourceset_items_sourceitem_templateset_item_templatepresenteritems_panel_rootitems_viewwrap_focusset_wrap_focuspreparing_containercontainer_preparedcontainer_index_changedcontainer_clearingDEFAULT_RECYCLE_KEYcontainer_from_indexcontainer_from_itemindex_from_containeritem_from_containerget_realized_containersscroll_into_viewscroll_into_view_itemitems_control_from_item_containerneeds_containerrefresh_containersget_next_control
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<ItemsControl>
Returns a strong reference to this object.
create_container_for_item_override
fn create_container_for_item_override(self: &Self, item: &Option<BoxedValue>, index: i32, recycle_key: Option<RecycleKey>) -> Ref<Control>
Creates or a container that can be used to display an item.
prepare_container_for_item_override
fn prepare_container_for_item_override(self: &Self, container: &Ref<Control>, item: &Option<BoxedValue>, index: i32)
Prepares the specified element to display the specified item.
container_for_item_prepared_override
fn container_for_item_prepared_override(self: &Self, container: &Ref<Control>, item: &Option<BoxedValue>, index: i32)
Called when a container has been fully prepared to display an item.
This method will be called when a container has been fully
prepared and added to the logical and visual trees, but may be
called before a layout pass has completed. It is called
immediately before the container_prepared event is raised.
container_index_changed_override
fn container_index_changed_override(self: &Self, container: &Ref<Control>, old_index: i32, new_index: i32)
Called when the index for a container changes due to an insertion or removal in the items collection.
clear_container_for_item_override
fn clear_container_for_item_override(self: &Self, container: &Ref<Control>)
Undoes the effects of the prepare_container_for_item_override
method.
needs_container_override
fn needs_container_override(self: &Self, item: &Option<BoxedValue>, index: i32) -> (bool, Option<RecycleKey>)
Determines whether the specified item can be its own container.
Returns true if the item needs a container; otherwise false if
the item can itself be used as a container. The second value is
a key that can be used to locate a previously recycled container
of the correct type, or None if the item cannot be recycled.
If the item is its own container then by definition it cannot be
recycled, so the key should be None.
on_items_view_collection_changed
fn on_items_view_collection_changed(self: &Self, e: &ItemsChangedEventArgs<'_>)
Called when the collection changed event is raised on the items view.
PSEUDO_CLASSES
const PSEUDO_CLASSES: PseudoClassesAttribute
The pseudoclasses set by the class.
item_container_theme_property
fn item_container_theme_property() -> &'static StyledProperty<Option<Ref<ControlTheme>>>
Defines the ItemContainerTheme property.
item_count_property
fn item_count_property() -> &'static DirectProperty<ItemsControl, i32>
Defines the ItemCount property.
items_panel_property
fn items_panel_property() -> &'static StyledProperty<Rc<dyn ITemplateOf<Option<Ref<Panel>>>>>
Defines the ItemsPanel property.
items_source_property
fn items_source_property() -> &'static StyledProperty<Option<ItemsSource>>
Defines the ItemsSource property.
item_template_property
fn item_template_property() -> &'static StyledProperty<Option<Rc<dyn IDataTemplate>>>
Defines the ItemTemplate property.
display_member_binding_property
fn display_member_binding_property() -> &'static StyledProperty<Option<AssignedBinding>>
Defines the DisplayMemberBinding property.
construct
fn construct() -> Self
Creates the class data; see ferroui_base::FerroObject::construct.
new
fn new() -> Ref<Self>
display_member_binding
fn display_member_binding(self: &Self) -> Option<AssignedBinding>
Gets or sets the binding to use for binding to the display member of each item.
set_display_member_binding
fn set_display_member_binding(self: &Self, value: Option<AssignedBinding>)
item_container_generator
fn item_container_generator(self: &Self) -> Rc<ItemContainerGenerator>
Gets the ItemContainerGenerator for the control.
items
fn items(self: &Self) -> ItemCollection
Gets the items to display.
You use either the items or the items_source property to specify
the collection that should be used to generate the content of your
ItemsControl. When the items_source property is set, the
items collection is made read-only and fixed-size.
When items_source is in use, setting the items_source property
to None removes the collection and restores usage to items,
which will be an empty ItemCollection.
item_container_theme
fn item_container_theme(self: &Self) -> Option<Ref<ControlTheme>>
Gets or sets the ControlTheme that is applied to the container
element generated for each item.
set_item_container_theme
fn set_item_container_theme(self: &Self, value: Option<Ref<ControlTheme>>)
item_count
fn item_count(self: &Self) -> i32
Gets the number of items being displayed by the ItemsControl.
items_panel
fn items_panel(self: &Self) -> Rc<dyn ITemplateOf<Option<Ref<Panel>>>>
Gets or sets the panel used to display the items.
set_items_panel
fn set_items_panel(self: &Self, value: Rc<dyn ITemplateOf<Option<Ref<Panel>>>>)
items_source
fn items_source(self: &Self) -> Option<ItemsSource>
Gets or sets a collection used to generate the content of the
ItemsControl.
A common scenario is to use an ItemsControl such as a list box
to display a data collection, or to bind an ItemsControl to a
collection object. To bind an ItemsControl to a collection
object, use the items_source property.
When the items_source property is set, the items collection is
made read-only and fixed-size.
When items_source is in use, setting the property to None
removes the collection and restores usage to items, which will be
an empty ItemCollection.
set_items_source
fn set_items_source(self: &Self, value: Option<ItemsSource>)
item_template
fn item_template(self: &Self) -> Option<Rc<dyn IDataTemplate>>
Gets or sets the data template used to display the items in the control.
set_item_template
fn set_item_template(self: &Self, value: Option<Rc<dyn IDataTemplate>>)
presenter
fn presenter(self: &Self) -> Option<Ref<ItemsPresenter>>
Gets the items presenter control.
items_panel_root
fn items_panel_root(self: &Self) -> Option<Ref<Panel>>
Gets the Panel specified by items_panel.
items_view
fn items_view(self: &Self) -> &Rc<ItemsSourceView>
Gets a read-only view of the items in the ItemsControl.
wrap_focus
fn wrap_focus(self: &Self) -> bool
Whether directional navigation wraps around at the first and last items.
set_wrap_focus
fn set_wrap_focus(self: &Self, value: bool)
preparing_container
fn preparing_container(self: &Self, handler: impl Fn(&ContainerPreparedEventArgs) -> () + 'static) -> Subscription
Occurs immediately before a container is prepared for use.
The prepared element might be newly created or an existing container that is being re-used.
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the control.
container_prepared
fn container_prepared(self: &Self, handler: impl Fn(&ContainerPreparedEventArgs) -> () + 'static) -> Subscription
Occurs each time a container is prepared for use.
The prepared element might be newly created or an existing container that is being re-used.
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the control.
container_index_changed
fn container_index_changed(self: &Self, handler: impl Fn(&ContainerIndexChangedEventArgs) -> () + 'static) -> Subscription
Occurs for each realized container when the index for the item it represents has changed.
This event is raised for each realized container where the index for the item it represents has changed. For example, when another item is added or removed in the data source, the index for items that come after in the ordering will be impacted.
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the control.
container_clearing
fn container_clearing(self: &Self, handler: impl Fn(&ContainerClearingEventArgs) -> () + 'static) -> Subscription
Occurs each time a container is cleared.
This event is raised immediately each time an container is cleared, such as when it falls outside the range of realized items or the corresponding item is removed.
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the control.
DEFAULT_RECYCLE_KEY
const DEFAULT_RECYCLE_KEY: RecycleKey
Gets a default recycle key that can be used when an ItemsControl
supports a single container type.
container_from_index
fn container_from_index(self: &Self, index: i32) -> Option<Ref<Control>>
Returns the container for the item at the specified index.
Returns the container for the item at the specified index within the
item collection, if the item has a container; otherwise, None.
container_from_item
fn container_from_item(self: &Self, item: &Option<BoxedValue>) -> Option<Ref<Control>>
Returns the container corresponding to the specified item.
Returns a container that corresponds to the specified item, if the
item has a container and exists in the collection; otherwise,
None.
index_from_container
fn index_from_container(self: &Self, container: &Ref<Control>) -> i32
Returns the index to the item that has the specified, generated container.
Returns the index to the item that corresponds to the specified
generated container, or -1 if container is not found.
item_from_container
fn item_from_container(self: &Self, container: &Ref<Control>) -> Option<BoxedValue>
Returns the item that corresponds to the specified, generated container.
Returns the contained item, or None if the container does not
contain an item.
get_realized_containers
fn get_realized_containers(self: &Self) -> Vec<Ref<Control>>
Gets the currently realized containers.
scroll_into_view
fn scroll_into_view(self: &Self, index: i32)
Scrolls the specified item into view.
scroll_into_view_item
fn scroll_into_view_item(self: &Self, item: &Option<BoxedValue>)
Scrolls the specified item into view.
items_control_from_item_container
fn items_control_from_item_container(container: &Ref<Control>) -> Option<Ref<ItemsControl>>
Returns the ItemsControl that owns the specified container
control.
Returns the owning ItemsControl or None if the control is not
an items container.
needs_container
fn needs_container<T: ObjectType + Upcast<Control>>(self: &Self, item: &Option<BoxedValue>) -> (bool, Option<RecycleKey>)
A default implementation of needs_container_override that returns
true and sets the recycle key to
DEFAULT_RECYCLE_KEY if the item is
not a T.
refresh_containers
fn refresh_containers(self: &Self)
Refreshes the containers displayed by the control.
Causes all containers to be unrealized and re-realized.
get_next_control
fn get_next_control(container: &dyn INavigableContainer, direction: NavigationDirection, from: Option<&Ref<InputElement>>, wrap: bool) -> Option<Ref<InputElement>>
Gets the next focusable, enabled and visible control of a container in the specified direction.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeTemplatedControlImplExtControlImplExtItemsControlImplExtBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyInputElementImplExtInteractiveImplExtLayoutableImplExtFerroObjectImplExtStyledElementImplExtClassDefaultsVisualImplExtErasedDestructorIntoEitherDerefUpcast<T>Upcast<ItemsControl>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleVisualImplLayoutableImplInteractiveImplControlImplFerroObjectImplStyledElementImplInputElementImplTemplatedControlImplItemsControlImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.