pub struct ItemsSourceView { /* private fields */ }Expand description
Represents a standardized view of the supported interactions between an items collection and an items control.
Implementations§
Source§impl ItemsSourceView
impl ItemsSourceView
Sourcepub fn empty() -> Rc<ItemsSourceView>
pub fn empty() -> Rc<ItemsSourceView>
Gets an empty ItemsSourceView.
Sourcepub fn new(source: ItemsSource) -> Rc<Self>
pub fn new(source: ItemsSource) -> Rc<Self>
Initializes a new instance of the view for the specified data source.
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 get_or_create(items: Option<&ItemsSource>) -> Rc<ItemsSourceView>
pub fn get_or_create(items: Option<&ItemsSource>) -> Rc<ItemsSourceView>
Gets or creates an ItemsSourceView for the specified source.
Returns empty if items is None, the view itself if items
is a view (ItemsSourceView isv => isv), otherwise a new view.
Sourcepub fn get_or_create_of<T: PropertyValue>(
items: Option<&ItemsSource>,
) -> ItemsSourceViewOf<T>
pub fn get_or_create_of<T: PropertyValue>( items: Option<&ItemsSource>, ) -> ItemsSourceViewOf<T>
Gets or creates a typed view for the specified source.
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 ICollectionChangedListener for ItemsSourceView
impl ICollectionChangedListener for ItemsSourceView
fn pre_changed(&self, e: &ItemsChangedEventArgs<'_>)
fn changed(&self, e: &ItemsChangedEventArgs<'_>)
fn post_changed(&self, e: &ItemsChangedEventArgs<'_>)
Source§impl IItemsList for ItemsSourceView
A view is a list of items itself (upstream ItemsSourceView : IReadOnlyList<object?>, IList, INotifyCollectionChanged): it can be the items source of a control, which then reads the
items and the changes through the view, and ItemsSourceView::get_or_create returns it as
it is. Its unique keys are those of its source.
impl IItemsList for ItemsSourceView
A view is a list of items itself (upstream ItemsSourceView : IReadOnlyList<object?>, IList, INotifyCollectionChanged): it can be the items source of a control, which then reads the
items and the changes through the view, and ItemsSourceView::get_or_create returns it as
it is. Its unique keys are those of its source.
Source§fn key_index_mapping(&self) -> Option<&dyn IKeyIndexMapping>
fn key_index_mapping(&self) -> Option<&dyn IKeyIndexMapping>
IKeyIndexMapping); None by default. An index is
never a key: a list without keys has none.Source§fn get_at(&self, index: usize) -> Option<BoxedValue>
fn get_at(&self, index: usize) -> Option<BoxedValue>
index. Panics if out of range.Source§fn index_of(&self, item: &Option<BoxedValue>) -> i32
fn index_of(&self, item: &Option<BoxedValue>) -> i32
item, or -1.Source§fn is_notifying(&self) -> bool
fn is_notifying(&self) -> bool
Source§fn add_collection_changed(
&self,
handler: Rc<ItemsChangedHandler>,
) -> Option<u64>
fn add_collection_changed( &self, handler: Rc<ItemsChangedHandler>, ) -> Option<u64>
remove_collection_changed, or
None if the list does not notify.Source§fn remove_collection_changed(&self, token: u64)
fn remove_collection_changed(&self, token: u64)
Source§impl IKeyIndexMapping for ItemsSourceView
impl IKeyIndexMapping for ItemsSourceView
Source§fn key_from_index(&self, index: i32) -> String
fn key_from_index(&self, index: i32) -> String
Source§fn index_from_key(&self, key: &str) -> i32
fn index_from_key(&self, key: &str) -> i32
-1 when no item
has it.Source§impl MarkupTyped for ItemsSourceView
impl MarkupTyped for ItemsSourceView
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
Auto Trait Implementations§
impl !Freeze for ItemsSourceView
impl !RefUnwindSafe for ItemsSourceView
impl !Send for ItemsSourceView
impl !Sync for ItemsSourceView
impl !UnwindSafe for ItemsSourceView
impl Unpin for ItemsSourceView
impl UnsafeUnpin for ItemsSourceView
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