pub struct ItemsSourceViewOf<T: PropertyValue> { /* private fields */ }Expand description
A typed ItemsSourceView: the items are read as T.
With T = BoxedValue the items are read untyped.
Implementations§
Source§impl<T: PropertyValue> ItemsSourceViewOf<T>
impl<T: PropertyValue> ItemsSourceViewOf<T>
Sourcepub fn new(source: ItemsSource) -> Self
pub fn new(source: ItemsSource) -> Self
Initializes a new instance of the view for the specified data source.
Sourcepub fn from_view(view: &ItemsSourceView) -> Self
pub fn from_view(view: &ItemsSourceView) -> Self
Reads an existing view as a typed view over the same source.
Sourcepub fn view(&self) -> &Rc<ItemsSourceView>
pub fn view(&self) -> &Rc<ItemsSourceView>
The untyped view.
Methods from Deref<Target = ItemsSourceView>§
Sourcepub fn has_key_index_mapping(&self) -> bool
pub fn has_key_index_mapping(&self) -> bool
Gets a value that indicates whether the items source can provide a unique key for
each item: whether the source implements IKeyIndexMapping
(WinUI ItemsSourceView.HasKeyIndexMapping).
Sourcepub fn key_from_index(&self, index: i32) -> String
pub fn key_from_index(&self, index: i32) -> String
Retrieves the unique key of the item at index from the items source
(WinUI ItemsSourceView.KeyFromIndex).
Panics if the source does not implement IKeyIndexMapping
(WinUI throws hresult_not_implemented), or if index is not the index of an item.
Sourcepub fn index_from_key(&self, key: &str) -> i32
pub fn index_from_key(&self, key: &str) -> i32
Retrieves the index of the item that has the unique key key, or -1 when no item
has it (WinUI ItemsSourceView.IndexFromKey).
Panics if the source does not implement IKeyIndexMapping
(WinUI throws hresult_not_implemented).
Sourcepub fn source(&self) -> ItemsSource
pub fn source(&self) -> ItemsSource
Gets the source collection.
Sourcepub fn add_collection_changed(&self, handler: Rc<ItemsChangedHandler>) -> u64
pub fn add_collection_changed(&self, handler: Rc<ItemsChangedHandler>) -> u64
Occurs when the collection has changed to indicate the reason for
the change and which items changed. Returns the token for
remove_collection_changed.
pub fn remove_collection_changed(&self, token: u64)
Sourcepub fn get_at(&self, index: usize) -> Option<BoxedValue>
pub fn get_at(&self, index: usize) -> Option<BoxedValue>
Retrieves the item at the specified index. Panics if out of range.
Sourcepub fn contains(&self, item: &Option<BoxedValue>) -> bool
pub fn contains(&self, item: &Option<BoxedValue>) -> bool
Whether the collection contains the item.
Sourcepub fn index_of(&self, item: &Option<BoxedValue>) -> i32
pub fn index_of(&self, item: &Option<BoxedValue>) -> i32
The index of the item, or -1.
Sourcepub fn iter(&self) -> impl Iterator<Item = Option<BoxedValue>>
pub fn iter(&self) -> impl Iterator<Item = Option<BoxedValue>>
The items, enumerated by index over the live collection.
Sourcepub fn to_vec(&self) -> Vec<Option<BoxedValue>>
pub fn to_vec(&self) -> Vec<Option<BoxedValue>>
A copy of the items.
Trait Implementations§
Source§impl<T: PropertyValue> Clone for ItemsSourceViewOf<T>
impl<T: PropertyValue> Clone for ItemsSourceViewOf<T>
Source§impl<T: PropertyValue> Deref for ItemsSourceViewOf<T>
impl<T: PropertyValue> Deref for ItemsSourceViewOf<T>
Source§type Target = ItemsSourceView
type Target = ItemsSourceView
Source§fn deref(&self) -> &ItemsSourceView
fn deref(&self) -> &ItemsSourceView
Auto Trait Implementations§
impl<T> !RefUnwindSafe for ItemsSourceViewOf<T>
impl<T> !Send for ItemsSourceViewOf<T>
impl<T> !Sync for ItemsSourceViewOf<T>
impl<T> !UnwindSafe for ItemsSourceViewOf<T>
impl<T> Freeze for ItemsSourceViewOf<T>
impl<T> Unpin for ItemsSourceViewOf<T>
impl<T> UnsafeUnpin for ItemsSourceViewOf<T>
Blanket Implementations§
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