pub struct ObservableCollectionExtended<T> { /* private fields */ }Expand description
An observable collection with ranges, loads and suspended notifications
(ObservableCollectionExtended<T>), the collection that the binding operators fill.
It is a shared handle over an ObservableCollection<T> (the base class upstream), which items
controls read and observe: collection is that collection. The changes made
through this handle raise the notifications of the base, except those that are suspended
(upstream’s overrides of OnCollectionChanged and OnPropertyChanged).
Deviation (DEVIATIONS.md, DynamicData): a subclass of .NET intercepts the notifications of every
change; here the changes made through collection directly are not
suspended.
Implementations§
Source§impl<T: Clone + PartialEq + 'static> ObservableCollectionExtended<T>
impl<T: Clone + PartialEq + 'static> ObservableCollectionExtended<T>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
An empty collection that has room for capacity items (ObservableCollectionExtended(new List<T>(capacity))).
Sourcepub fn from_items(items: Vec<T>) -> Self
pub fn from_items(items: Vec<T>) -> Self
A collection of the items (ObservableCollectionExtended(IEnumerable<T>),
ObservableCollectionExtended(List<T>)).
Sourcepub fn collection(&self) -> &ObservableCollection<T>
pub fn collection(&self) -> &ObservableCollection<T>
The observable collection of the items (the base class upstream).
Sourcepub fn add_collection_changed(
&self,
handler: Rc<CollectionChangedHandler<T>>,
) -> u64
pub fn add_collection_changed( &self, handler: Rc<CollectionChangedHandler<T>>, ) -> u64
Adds a handler of the typed change notifications; returns the token that removes it
(CollectionChanged +=).
Sourcepub fn remove_collection_changed(&self, token: u64) -> bool
pub fn remove_collection_changed(&self, token: u64) -> bool
Removes a handler (CollectionChanged -=).
pub fn is_empty(&self) -> bool
Sourcepub fn set(&self, index: usize, item: T)
pub fn set(&self, index: usize, item: T)
Replaces the item at index (the indexer’s setter, SetItem).
Sourcepub fn move_item(&self, old_index: usize, new_index: usize)
pub fn move_item(&self, old_index: usize, new_index: usize)
Moves the item at old_index to new_index (Move, MoveItem).
Sourcepub fn add_range(&self, items: impl IntoIterator<Item = T>)
pub fn add_range(&self, items: impl IntoIterator<Item = T>)
Adds the items at the end, one at a time (AddRange).
Sourcepub fn insert_range(&self, items: impl IntoIterator<Item = T>, index: usize)
pub fn insert_range(&self, items: impl IntoIterator<Item = T>, index: usize)
Inserts the items from index, one at a time (InsertRange).
Sourcepub fn load(&self, items: impl IntoIterator<Item = T>)
pub fn load(&self, items: impl IntoIterator<Item = T>)
Clears the collection and adds the items (Load).
Sourcepub fn remove_range(&self, index: usize, count: usize)
pub fn remove_range(&self, index: usize, count: usize)
Removes count items from index, one at a time (RemoveRange).
Sourcepub fn suspend_count(&self) -> Rc<dyn IDisposable>
pub fn suspend_count(&self) -> Rc<dyn IDisposable>
Holds back the notifications of Count until the handle is disposed, which raises Count
once if it changed (SuspendCount).
Sourcepub fn suspend_notifications(&self) -> Rc<dyn IDisposable>
pub fn suspend_notifications(&self) -> Rc<dyn IDisposable>
Holds back the notifications of changes and of Count until the handle is disposed, which
raises Count and a reset (SuspendNotifications).
Sourcepub fn on_property_changed(&self, name: &str)
pub fn on_property_changed(&self, name: &str)
Raises PropertyChanged, unless it is Count and the count is suspended
(OnPropertyChanged).
Sourcepub fn on_collection_changed(
&self,
action: NotifyCollectionChangedAction,
new_items: &[T],
old_items: &[T],
new_starting_index: i32,
old_starting_index: i32,
)
pub fn on_collection_changed( &self, action: NotifyCollectionChangedAction, new_items: &[T], old_items: &[T], new_starting_index: i32, old_starting_index: i32, )
Raises CollectionChanged, unless the notifications are suspended (OnCollectionChanged).
Trait Implementations§
Source§impl<T> Clone for ObservableCollectionExtended<T>
impl<T> Clone for ObservableCollectionExtended<T>
Source§impl<T: Clone + PartialEq + 'static> From<&ObservableCollectionExtended<T>> for ReadOnlyObservableCollection<T>
impl<T: Clone + PartialEq + 'static> From<&ObservableCollectionExtended<T>> for ReadOnlyObservableCollection<T>
Source§fn from(collection: &ObservableCollectionExtended<T>) -> Self
fn from(collection: &ObservableCollectionExtended<T>) -> Self
The view of the collection (new ReadOnlyObservableCollection<T>(observableCollectionExtended)).
Source§impl<T: Clone + PartialEq + 'static> IExtendedList<T> for ObservableCollectionExtended<T>
impl<T: Clone + PartialEq + 'static> IExtendedList<T> for ObservableCollectionExtended<T>
Source§fn insert_range(&mut self, items: Vec<T>, index: usize)
fn insert_range(&mut self, items: Vec<T>, index: usize)
index (InsertRange).Source§fn move_index(&mut self, original: usize, destination: usize)
fn move_index(&mut self, original: usize, destination: usize)
original to destination (Move(int, int)).Source§impl<T: Clone + PartialEq + 'static> IList<T> for ObservableCollectionExtended<T>
The collection as a list of DynamicData (IList<T>, IExtendedList<T>): what ListEx and
SortAndBind apply changes to.
impl<T: Clone + PartialEq + 'static> IList<T> for ObservableCollectionExtended<T>
The collection as a list of DynamicData (IList<T>, IExtendedList<T>): what ListEx and
SortAndBind apply changes to.
Source§fn remove(&mut self, item: &T) -> bool
fn remove(&mut self, item: &T) -> bool
item; false when it is not in the list (Remove).Source§fn add_range(&mut self, items: Vec<T>)
fn add_range(&mut self, items: Vec<T>)
ListEx.AddRange): one by one unless the list adds ranges.Source§fn add_or_insert_range(&mut self, items: Vec<T>, index: Option<usize>)
fn add_or_insert_range(&mut self, items: Vec<T>, index: Option<usize>)
index, or adds them without an index (ListEx.AddOrInsertRange): in
reverse order at the index unless the list inserts ranges, as upstream does.Source§fn remove_range(&mut self, index: usize, count: usize)
fn remove_range(&mut self, index: usize, count: usize)
Source§fn supports_ranges(&self) -> bool
fn supports_ranges(&self) -> bool
List<T> or IExtendedList<T>).Source§fn move_item(&mut self, original: usize, destination: usize)
fn move_item(&mut self, original: usize, destination: usize)
original to destination (the Moved case of ListEx.Clone).Source§fn index_of_with(
&self,
item: &T,
comparer: &dyn Fn(&T, &T) -> bool,
) -> Option<usize>
fn index_of_with( &self, item: &T, comparer: &dyn Fn(&T, &T) -> bool, ) -> Option<usize>
item by comparer (ListEx.IndexOf(IEnumerable, T, IEqualityComparer)).Source§fn refresh_at(&mut self, index: usize, item: T)
fn refresh_at(&mut self, index: usize, item: T)
index (the Refresh case of ListEx.Clone): the item is
removed and inserted again unless the list reports refreshes.Source§impl<T> INotifyCollectionChanged for ObservableCollectionExtended<T>
impl<T> INotifyCollectionChanged for ObservableCollectionExtended<T>
Source§fn collection_changed(&self) -> &Event<CollectionChange>
fn collection_changed(&self) -> &Event<CollectionChange>
Source§impl<T: Clone + PartialEq + 'static> INotifyCollectionChangedSuspender for ObservableCollectionExtended<T>
impl<T: Clone + PartialEq + 'static> INotifyCollectionChangedSuspender for ObservableCollectionExtended<T>
Source§fn suspend_count(&self) -> Rc<dyn IDisposable>
fn suspend_count(&self) -> Rc<dyn IDisposable>
Count until the handle is disposed, which raises Count
once if it changed (SuspendCount).Source§fn suspend_notifications(&self) -> Rc<dyn IDisposable>
fn suspend_notifications(&self) -> Rc<dyn IDisposable>
Count until the handle is disposed, which
raises Count and a reset (SuspendNotifications).Source§impl<T> INotifyPropertyChanged for ObservableCollectionExtended<T>
impl<T> INotifyPropertyChanged for ObservableCollectionExtended<T>
Source§fn property_changed(&self) -> &Event<str>
fn property_changed(&self) -> &Event<str>
Source§fn as_notify_property_changing(&self) -> Option<&dyn INotifyPropertyChanging>
fn as_notify_property_changing(&self) -> Option<&dyn INotifyPropertyChanging>
INotifyPropertyChanging, when it also raises the event of a property
that is about to change; None by default. Read moreSource§impl<T: Clone + PartialEq + 'static> IObservableCollection<T> for ObservableCollectionExtended<T>
impl<T: Clone + PartialEq + 'static> IObservableCollection<T> for ObservableCollectionExtended<T>
Source§impl<T: Clone + PartialEq + 'static> ObservableCollectionEx<T> for ObservableCollectionExtended<T>
impl<T: Clone + PartialEq + 'static> ObservableCollectionEx<T> for ObservableCollectionExtended<T>
Source§fn notifying_collection(&self) -> ObservableCollection<T>
fn notifying_collection(&self) -> ObservableCollection<T>
Source§fn observe_collection_changes(
&self,
) -> Rc<dyn IObservable<CollectionChangedEventPattern<T>>>
fn observe_collection_changes( &self, ) -> Rc<dyn IObservable<CollectionChangedEventPattern<T>>>
ObserveCollectionChanges).Source§fn to_observable_change_set(&self) -> Rc<dyn IObservable<ChangeSet<T>>>
fn to_observable_change_set(&self) -> Rc<dyn IObservable<ChangeSet<T>>>
ToObservableChangeSet<T>(), ToObservableChangeSet<TCollection, T>()).Source§fn to_observable_change_set_with_key<K: Eq + Hash + Clone + 'static>(
&self,
key_selector: impl Fn(&T) -> K + 'static,
) -> Rc<dyn IObservable<ChangeSet<T, K>>>
fn to_observable_change_set_with_key<K: Eq + Hash + Clone + 'static>( &self, key_selector: impl Fn(&T) -> K + 'static, ) -> Rc<dyn IObservable<ChangeSet<T, K>>>
to_observable_change_set with each item keyed by
key_selector (ToObservableChangeSet<TObject, TKey>(Func<TObject, TKey>)).