Namespace:
System.Windows
Assembly:
PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Visual Basic (Declaration)
Public Class FreezableCollection(Of T As DependencyObject) _
Inherits Animatable _
Implements IList, ICollection, IList(Of T), _
ICollection(Of T), IEnumerable(Of T), IEnumerable
Dim instance As FreezableCollection(Of T)
public class FreezableCollection<T> : Animatable,
IList, ICollection, IList<T>, ICollection<T>, IEnumerable<T>,
IEnumerable
where T : DependencyObject
generic<typename T>
where T : DependencyObject
public ref class FreezableCollection : public Animatable,
IList, ICollection, IList<T>, ICollection<T>, IEnumerable<T>,
IEnumerable
JScript does not support generic types or methods.
Type Parameters
- T
The type of collection. This type must be a DependencyObject or a derived class.
This class is provided to enable the creation of custom collection types that fully support data binding, change notification, property invalidation, and animation of its contents.
XAML Usage for FreezableCollection
FreezableCollection<(Of <(T>)>) supports a limited XAML syntax.
As an object element at the root, you can theoretically specify an unconstrained FreezableCollection<(Of <(T>)>) object element, which must also specify the x:TypeArguments Attribute to declare the constraint. However, this is not a common scenario, because to do this, the FreezableCollection<(Of <(T>)>) must be the root element. This limitation exists because the XAML processor implementation in WPF can only support x:TypeArguments Attribute when the element it is being set on is the root element, and you must use x:TypeArguments on any open constraint generic if you want to instantiate a generic type in XAML. It is unlikely that you want a FreezableCollection<(Of <(T>)>) as the root element, even as loose XAML.
If you derive from FreezableCollection<(Of <(T>)>) and apply a type constraint in the derived collection, the derived collection can support a variety of usages. This is possible because the constraint in your derivation eliminates the need to pass x:TypeArguments.
The typical XAML usage for such a derived collection is through implicit collection syntax. Collections that support certain interfaces do not need to specify the collection itself as an object element. For details on collection syntax in XAML, see XAML Syntax Terminology. For instance, an object with a property where the property was of type FreezableCollection<(Of <(T>)>) constrained by DependencyObject could support the following syntax:
<object>
<object.property>
oneOrMoreDependencyObjectElements
</object.property>
</object>
As long as you do not hide the default constructor, the derived collection can also support an object element syntax (where the object element is explicit, as opposed to the implicit usage shown above). It does not need to be the root element. Or, you can also use the derived collection as a root element, without needing to specify x:TypeArguments, although using a collection as a root element is uncommon.
Any child elements of the collection in either of the above scenarios must be of the type of either the implemented constraint, or as specified by x:TypeArguments.
System..::.Object
System.Windows.Threading..::.DispatcherObject
System.Windows..::.DependencyObject
System.Windows..::.Freezable
System.Windows.Media.Animation..::.Animatable
System.Windows..::.FreezableCollection<(Of <(T>)>)
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0
Reference
Other Resources