Windows.UI.Xaml.DependencyObjectCollection
June 22, 2022 ยท View on GitHub
-description
Implements a practical collection class that can contain DependencyObject items.
-remarks
The purpose of the DependencyObjectCollection class is mainly to support the tooling and portability of behaviors. Behaviors are a technique for defining certain basic interactions of a UI element entirely in XAML, without requiring an event handler and code-behind.
If you're interested in implementing a business object class that supports collection-changed notifications you should use ObservableCollection or one of the interface patterns that supports changed events. For more info see Data binding in depth.
Enumerating the collection in C# or Microsoft Visual Basic
A DependencyObjectCollection is enumerable, so you can use language-specific syntax such as foreach in C# to enumerate the items in the collection. The compiler does the type-casting for you and you won't need to cast to IEnumerable<DependencyObject> explicitly. If you do need to cast explicitly, for example if you want to call GetEnumerator, cast to IEnumerable<T> with a DependencyObject constraint.
-examples
-see-also
DependencyObject, IObservableVector(DependencyObject), IVector(DependencyObject), IIterable(DependencyObject), IList<T>