Show / Hide Table of Contents

Class ObservableObjectCollection

Implements a collection of objects.

Inheritance
System.Object
System.Collections.ObjectModel.Collection<System.Object>
System.Collections.ObjectModel.ObservableCollection<System.Object>
ObservableObjectCollection
Implements
System.Collections.Generic.IList<System.Object>
System.Collections.Generic.IReadOnlyList<System.Object>
System.Collections.Generic.IReadOnlyCollection<System.Object>
System.Collections.IList
System.Collections.ICollection
System.Collections.Specialized.INotifyCollectionChanged
System.ComponentModel.INotifyPropertyChanged
System.Collections.Generic.ICollection<System.Object>
System.Collections.Generic.IEnumerable<System.Object>
System.Collections.IEnumerable
Inherited Members
System.Collections.ObjectModel.ObservableCollection<System.Object>.BlockReentrancy()
System.Collections.ObjectModel.ObservableCollection<System.Object>.CheckReentrancy()
System.Collections.ObjectModel.ObservableCollection<System.Object>.Move(System.Int32, System.Int32)
System.Collections.ObjectModel.ObservableCollection<System.Object>.MoveItem(System.Int32, System.Int32)
System.Collections.ObjectModel.ObservableCollection<System.Object>.OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs)
System.Collections.ObjectModel.ObservableCollection<System.Object>.OnPropertyChanged(System.ComponentModel.PropertyChangedEventArgs)
System.Collections.ObjectModel.ObservableCollection<System.Object>.CollectionChanged
System.Collections.ObjectModel.ObservableCollection<System.Object>.PropertyChanged
System.Collections.ObjectModel.ObservableCollection<System.Object>.System.ComponentModel.INotifyPropertyChanged.PropertyChanged
System.Collections.ObjectModel.Collection<System.Object>.System.Collections.IList.get_Item(System.Int32)
System.Collections.ObjectModel.Collection<System.Object>.System.Collections.IList.set_Item(System.Int32, System.Object)
System.Collections.ObjectModel.Collection<System.Object>.Add(System.Object)
System.Collections.ObjectModel.Collection<System.Object>.Clear()
System.Collections.ObjectModel.Collection<System.Object>.Contains(System.Object)
System.Collections.ObjectModel.Collection<System.Object>.CopyTo(System.Object[], System.Int32)
System.Collections.ObjectModel.Collection<System.Object>.GetEnumerator()
System.Collections.ObjectModel.Collection<System.Object>.IndexOf(System.Object)
System.Collections.ObjectModel.Collection<System.Object>.Insert(System.Int32, System.Object)
System.Collections.ObjectModel.Collection<System.Object>.Remove(System.Object)
System.Collections.ObjectModel.Collection<System.Object>.RemoveAt(System.Int32)
System.Collections.ObjectModel.Collection<System.Object>.System.Collections.ICollection.CopyTo(System.Array, System.Int32)
System.Collections.ObjectModel.Collection<System.Object>.System.Collections.IEnumerable.GetEnumerator()
System.Collections.ObjectModel.Collection<System.Object>.System.Collections.IList.Add(System.Object)
System.Collections.ObjectModel.Collection<System.Object>.System.Collections.IList.Contains(System.Object)
System.Collections.ObjectModel.Collection<System.Object>.System.Collections.IList.IndexOf(System.Object)
System.Collections.ObjectModel.Collection<System.Object>.System.Collections.IList.Insert(System.Int32, System.Object)
System.Collections.ObjectModel.Collection<System.Object>.System.Collections.IList.Remove(System.Object)
System.Collections.ObjectModel.Collection<System.Object>.Count
System.Collections.ObjectModel.Collection<System.Object>.Item[System.Int32]
System.Collections.ObjectModel.Collection<System.Object>.Items
System.Collections.ObjectModel.Collection<System.Object>.System.Collections.Generic.ICollection<System.Object>.IsReadOnly
System.Collections.ObjectModel.Collection<System.Object>.System.Collections.ICollection.IsSynchronized
System.Collections.ObjectModel.Collection<System.Object>.System.Collections.ICollection.SyncRoot
System.Collections.ObjectModel.Collection<System.Object>.System.Collections.IList.IsFixedSize
System.Collections.ObjectModel.Collection<System.Object>.System.Collections.IList.IsReadOnly
System.Collections.ObjectModel.Collection<System.Object>.System.Collections.IList.Item[System.Int32]
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: System.Windows.Controls
Assembly: OpenSilver.Controls.Input.Toolkit.dll
Syntax
public class ObservableObjectCollection : ObservableCollection<object>, IList<object>, IReadOnlyList<object>, IReadOnlyCollection<object>, IList, ICollection, INotifyCollectionChanged, INotifyPropertyChanged, ICollection<object>, IEnumerable<object>, IEnumerable
Remarks

ObservableObjectCollection is intended to simplify the task of populating an ItemsSource property in XAML and allows for readonly collections.

Examples
<ItemsControl.ItemsSource>
    <controls:ObservableObjectCollection>
        <TextBlock Text="Object 1" />
        <TextBlock Text="Object 2" />
    </controls:ObservableObjectCollection>
</ItemsControl.ItemsSource>

Constructors

| Improve this Doc View Source

ObservableObjectCollection()

Initializes a new instance of the ObservableObjectCollection class.

Declaration
public ObservableObjectCollection()
| Improve this Doc View Source

ObservableObjectCollection(IEnumerable)

Initializes a new instance of the ObservableObjectCollection class.

Declaration
public ObservableObjectCollection(IEnumerable collection)
Parameters
Type Name Description
System.Collections.IEnumerable collection

The collection whose items will be copied.

Properties

| Improve this Doc View Source

IsReadOnly

Gets a value indicating whether the collection is read only.

Declaration
public bool IsReadOnly { get; }
Property Value
Type Description
System.Boolean

True if read only; otherwise, false.

Methods

| Improve this Doc View Source

ClearItems()

Removes all items from the collection.

Declaration
protected override void ClearItems()
Overrides
System.Collections.ObjectModel.ObservableCollection<System.Object>.ClearItems()
| Improve this Doc View Source

InsertItem(Int32, Object)

Inserts an item into the collection at the specified index.

Declaration
protected override void InsertItem(int index, object item)
Parameters
Type Name Description
System.Int32 index

The zero-based index at which item should be inserted.

System.Object item

The object to insert.

Overrides
System.Collections.ObjectModel.ObservableCollection<System.Object>.InsertItem(System.Int32, System.Object)
| Improve this Doc View Source

RemoveItem(Int32)

Removes the item at the specified index of the collection.

Declaration
protected override void RemoveItem(int index)
Parameters
Type Name Description
System.Int32 index

The zero-based index of the element to remove.

Overrides
System.Collections.ObjectModel.ObservableCollection<System.Object>.RemoveItem(System.Int32)
| Improve this Doc View Source

SetItem(Int32, Object)

Replaces the element at the specified index.

Declaration
protected override void SetItem(int index, object item)
Parameters
Type Name Description
System.Int32 index

The zero-based index of the element to replace.

System.Object item

The new value for the element at the specified index.

Overrides
System.Collections.ObjectModel.ObservableCollection<System.Object>.SetItem(System.Int32, System.Object)

Explicit Interface Implementations

| Improve this Doc View Source

ICollection<Object>.IsReadOnly

Gets a value indicating whether the System.Collections.Generic.ICollection<T> is read-only.

Declaration
bool ICollection<object>.IsReadOnly { get; }
Returns
Type Description
System.Boolean

Implements

System.Collections.Generic.IList<T>
System.Collections.Generic.IReadOnlyList<T>
System.Collections.Generic.IReadOnlyCollection<T>
System.Collections.IList
System.Collections.ICollection
System.Collections.Specialized.INotifyCollectionChanged
System.ComponentModel.INotifyPropertyChanged
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
  • Improve this Doc
  • View Source