Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

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

InvalidOperationException

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.

Action

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

ADD
Show:
© 2015 Microsoft