pub struct CommandBarElementCollection(/* private fields */);Expand description
The read-only, notifying collection of command bar elements that a
CommandBar exposes as VisiblePrimaryCommands and OverflowItems
(the read-only observable collection of the reference).
The collection is a reference object: the value is a shared handle, clones refer to the same collection and handles compare by identity. Only the command bar that owns it changes it. As an items source its elements that are controls are items boxed as controls, so that an items control presents them as their own containers.
Implementations§
Source§impl CommandBarElementCollection
impl CommandBarElementCollection
Sourcepub fn get(&self, index: usize) -> Rc<dyn ICommandBarElement>
pub fn get(&self, index: usize) -> Rc<dyn ICommandBarElement>
The element at index. Panics if out of range.
Sourcepub fn snapshot(&self) -> Rc<Vec<Rc<dyn ICommandBarElement>>>
pub fn snapshot(&self) -> Rc<Vec<Rc<dyn ICommandBarElement>>>
The elements as they are now. The snapshot shares storage with the collection until the collection changes.
Sourcepub fn to_vec(&self) -> Vec<Rc<dyn ICommandBarElement>>
pub fn to_vec(&self) -> Vec<Rc<dyn ICommandBarElement>>
A copy of the elements.
Sourcepub fn contains(&self, element: &Rc<dyn ICommandBarElement>) -> bool
pub fn contains(&self, element: &Rc<dyn ICommandBarElement>) -> bool
Whether the collection contains element.
Sourcepub fn index_of(&self, element: &Rc<dyn ICommandBarElement>) -> Option<usize>
pub fn index_of(&self, element: &Rc<dyn ICommandBarElement>) -> Option<usize>
The index of element, if the collection contains it.
Sourcepub fn add_collection_changed(
&self,
handler: Rc<CollectionChangedHandler<Rc<dyn ICommandBarElement>>>,
) -> u64
pub fn add_collection_changed( &self, handler: Rc<CollectionChangedHandler<Rc<dyn ICommandBarElement>>>, ) -> u64
Subscribes to the changes of the collection. Returns the token for
remove_collection_changed.
Sourcepub fn remove_collection_changed(&self, token: u64) -> bool
pub fn remove_collection_changed(&self, token: u64) -> bool
Unsubscribes a handler.
Sourcepub fn as_items_source(&self) -> ItemsSource
pub fn as_items_source(&self) -> ItemsSource
The collection as the source of the items of an items control.
Trait Implementations§
Source§impl Clone for CommandBarElementCollection
impl Clone for CommandBarElementCollection
Source§impl Debug for CommandBarElementCollection
impl Debug for CommandBarElementCollection
Source§impl From<CommandBarElementCollection> for ItemsSource
impl From<CommandBarElementCollection> for ItemsSource
Source§fn from(value: CommandBarElementCollection) -> Self
fn from(value: CommandBarElementCollection) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for CommandBarElementCollection
impl !Send for CommandBarElementCollection
impl !Sync for CommandBarElementCollection
impl !UnwindSafe for CommandBarElementCollection
impl Freeze for CommandBarElementCollection
impl Unpin for CommandBarElementCollection
impl UnsafeUnpin for CommandBarElementCollection
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more