Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Freezable.GetAsFrozen Method

Creates a frozen copy of this Freezable , using base (non-animated) property values. Because the copy is frozen, any frozen sub-objects are copied by reference.

Namespace: System.Windows
Assembly: WindowsBase (in windowsbase.dll)

public Freezable GetAsFrozen ()
public Freezable GetAsFrozen ()
public function GetAsFrozen () : Freezable
You cannot use methods in XAML.

Return Value

A frozen copy of this Freezable. The copy's IsFrozen property is set to true.

Exception typeCondition


This Freezable cannot be frozen because it contains expressions or animated properties.

You should check the CanFreeze method before calling this method to verify that this Freezable can be frozen. Using this method is similar to creating a copy using the Clone and then freezing it with the Freeze method.

The GetAsFrozen and GetCurrentValueAsFrozen methods can improve copying performance because they don't clone Freezable sub-objects that are already frozen, they only copy them by reference.

The following table summarizes the differences between the GetAsFrozen and GetCurrentValueAsFrozen methods.


GetAsFrozen method behavior

GetCurrentValueAsFrozen method behavior

Copying a dependency property that has an expression

The method throws a InvalidOperationException because it can't Freeze the property.

The current value of the expression is copied, but not the expression itself.

Copying an animated dependency property

The property's base (non-animated) value is copied. Animations are not copied.

The property's current animated value is copied. Animations are not copied.

Note that unset properties are not copied, nor are read-only properties.

To create a copy of this Freezable that is not frozen, use the Clone method.

Notes to Implementers: This method uses the virtual GetAsFrozenCore method to produce the clone.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

© 2017 Microsoft