Show / Hide Table of Contents

Class DependencyObjectCollection<T>

Represents a collection of DependencyObject instances of a specified type.

Inheritance
System.Object
DependencyObject
DependencyObjectCollection<T>
ConditionCollection
AttachableCollection<T>
Implements
System.Collections.Generic.IList<T>
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IList
System.Collections.ICollection
System.Collections.IEnumerable
System.Collections.Specialized.INotifyCollectionChanged
Inherited Members
DependencyObject.GetValue(DependencyProperty)
DependencyObject.SetCurrentValue(DependencyProperty, Object)
DependencyObject.ReadLocalValue(DependencyProperty)
DependencyObject.SetValue(DependencyProperty, Object)
DependencyObject.SetValue(DependencyPropertyKey, Object)
DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs)
DependencyObject.CoerceValue(DependencyProperty)
DependencyObject.Dispatcher
DependencyObject.INTERNAL_OnAttachedToVisualTree()
DependencyObject.INTERNAL_OnDetachedFromVisualTree()
DependencyObject.ClearValue(DependencyProperty)
DependencyObject.ClearValue(DependencyPropertyKey)
DependencyObject.CheckAccess()
DependencyObject.GetAnimationBaseValue(DependencyProperty)
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
Assembly: OpenSilver.dll
Syntax
public class DependencyObjectCollection<T> : DependencyObject, IDependencyObject, IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable, INotifyCollectionChanged
Type Parameters
Name Description
T

The type of items in the collection.

Constructors

| Improve this Doc View Source

DependencyObjectCollection()

Initializes a new instance of the DependencyObjectCollection<T> class.

Declaration
public DependencyObjectCollection()

Properties

| Improve this Doc View Source

Count

Gets the number of objects in the collection.

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

IsReadOnly

Gets a value that indicates whether the collection can be modified.

Declaration
public bool IsReadOnly { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Item[Int32]

Gets or sets the object at the specified index.

Declaration
public T this[int index] { get; set; }
Parameters
Type Name Description
System.Int32 index

The index of the object to get or set.

Property Value
Type Description
T

The object at the specified index.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

index is less than zero or greater than the number of items in the collection.

System.ArgumentException

The specified value when setting this property is not a DependencyObject.

System.InvalidOperationException

The property is being set in a CollectionChanged event handler.

Methods

| Improve this Doc View Source

Add(T)

Adds the specified object to the end of the collection.

Declaration
public void Add(T item)
Parameters
Type Name Description
T item

The object to add to the collection.

Exceptions
Type Condition
System.ArgumentNullException

item is not a DependencyObject.

System.InvalidOperationException

The method is being called in a CollectionChanged event handler.

| Improve this Doc View Source

Clear()

Removes all objects from the collection.

Declaration
public void Clear()
Exceptions
Type Condition
System.InvalidOperationException

The method is being called in a CollectionChanged event handler.

| Improve this Doc View Source

Contains(T)

Gets a value that indicates whether the specified object is in the collection.

Declaration
public bool Contains(T item)
Parameters
Type Name Description
T item

The object to check for in the collection.

Returns
Type Description
System.Boolean

true if the object is in the collection; otherwise, false.

Exceptions
Type Condition
System.ArgumentException

item is not a DependencyObject.

| Improve this Doc View Source

CopyTo(T[], Int32)

Copies the objects in the collection to the specified array, starting at the specified index.

Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
Type Name Description
T[] array

The destination array.

System.Int32 arrayIndex

The index of the first object to copy.

| Improve this Doc View Source

GetEnumerator()

Gets an enumerator that iterates through the collection.

Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<T>

An enumerator for the collection.

| Improve this Doc View Source

IndexOf(T)

Gets the index of the specified object within the collection, or -1 if the object is not in the collection.

Declaration
public int IndexOf(T item)
Parameters
Type Name Description
T item

The object to locate in the collection.

Returns
Type Description
System.Int32

The index of the first occurrence of item within the collection, or -1 if item is not in the collection.

Exceptions
Type Condition
System.ArgumentException

item is not a DependencyObject.

| Improve this Doc View Source

Insert(Int32, T)

Adds the specified object to the collection at the specified index.

Declaration
public void Insert(int index, T item)
Parameters
Type Name Description
System.Int32 index

The index at which to add the object.

T item

The object to add.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

index is less than zero or greater than the number of items in the collection.

System.ArgumentException

item is not a DependencyObject.

System.InvalidOperationException

The method is being called in a CollectionChanged event handler.

| Improve this Doc View Source

Remove(T)

Removes the specified object from the collection.

Declaration
public bool Remove(T item)
Parameters
Type Name Description
T item

The object to remove.

Returns
Type Description
System.Boolean

true if the object was removed; false if the object was not found in the collection.

Exceptions
Type Condition
System.ArgumentException

item is not a DependencyObject.

System.InvalidOperationException

The method is being called in a CollectionChanged event handler.

| Improve this Doc View Source

RemoveAt(Int32)

Removes the object at the specified index from the collection.

Declaration
public void RemoveAt(int index)
Parameters
Type Name Description
System.Int32 index

The index of the object to remove.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

index is less than zero or greater than the highest index in the collection.

System.InvalidOperationException

The method is being called in a CollectionChanged event handler.

Events

| Improve this Doc View Source

CollectionChanged

Occurs when items in the collection are added, removed, or replaced.

Declaration
public event NotifyCollectionChangedEventHandler CollectionChanged
Event Type
Type Description
System.Collections.Specialized.NotifyCollectionChangedEventHandler

Explicit Interface Implementations

| Improve this Doc View Source

ICollection.CopyTo(Array, Int32)

Declaration
void ICollection.CopyTo(Array array, int arrayIndex)
Parameters
Type Name Description
System.Array array
System.Int32 arrayIndex
| Improve this Doc View Source

ICollection.IsSynchronized

Declaration
bool ICollection.IsSynchronized { get; }
Returns
Type Description
System.Boolean
| Improve this Doc View Source

ICollection.SyncRoot

Declaration
object ICollection.SyncRoot { get; }
Returns
Type Description
System.Object
| Improve this Doc View Source

IEnumerable.GetEnumerator()

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
System.Collections.IEnumerator
| Improve this Doc View Source

IList.Add(Object)

Declaration
int IList.Add(object item)
Parameters
Type Name Description
System.Object item
Returns
Type Description
System.Int32
| Improve this Doc View Source

IList.Contains(Object)

Declaration
bool IList.Contains(object item)
Parameters
Type Name Description
System.Object item
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IList.IndexOf(Object)

Declaration
int IList.IndexOf(object value)
Parameters
Type Name Description
System.Object value
Returns
Type Description
System.Int32
| Improve this Doc View Source

IList.Insert(Int32, Object)

Declaration
void IList.Insert(int index, object value)
Parameters
Type Name Description
System.Int32 index
System.Object value
| Improve this Doc View Source

IList.IsFixedSize

Declaration
bool IList.IsFixedSize { get; }
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IList.Item[Int32]

Declaration
object IList.this[int index] { get; set; }
Parameters
Type Name Description
System.Int32 index
Returns
Type Description
System.Object
| Improve this Doc View Source

IList.Remove(Object)

Declaration
void IList.Remove(object value)
Parameters
Type Name Description
System.Object value

Implements

System.Collections.Generic.IList<T>
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IList
System.Collections.ICollection
System.Collections.IEnumerable
System.Collections.Specialized.INotifyCollectionChanged

Extension Methods

DependencyObjectHelper.GetSelfAndAncestors(DependencyObject)
VisualTreeExtensions.GetVisualAncestors(DependencyObject)
VisualTreeExtensions.GetVisualAncestorsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualChildren(DependencyObject)
VisualTreeExtensions.GetVisualChildrenAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualDescendants(DependencyObject)
VisualTreeExtensions.GetVisualDescendantsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualSiblings(DependencyObject)
VisualTreeExtensions.GetVisualSiblingsAndSelf(DependencyObject)
  • Improve this Doc
  • View Source