Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Freezable.CloneCurrentValueCore Method

Makes the instance a modifiable clone (deep copy) of the specified Freezable using current property values.

Namespace:  System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)
protected virtual void CloneCurrentValueCore(
	Freezable sourceFreezable
)

Parameters

sourceFreezable
Type: System.Windows.Freezable

The Freezable to be cloned.

This method is called by the CloneCurrentValue method and should not be called directly from your code, except when calling the base implementation while overriding this method. To create a modifiable copy of the current object, call CloneCurrentValue instead of calling this method directly.

Notes to Inheritors

If you derive from Freezable, you may need to override this method. Reasons to override include the following:

  • Your derived class has data that is not exposed via dependency properties.

  • Your derived class must perform extra initialization work that cannot be accomplished by simply overriding CreateInstanceCore. For example, this applies if your derived class implements ISupportInitialize.

Classes that store all their data in dependency properties and that do not need to perform extra initialization work do not need to override CloneCurrentValueCore.

It is essential that all implementations call the base implementation of this method. Implementations should only perform work that is not performed by the default implementation. The default implementation makes deep copies of all writable, locally set properties. If the object contains dependency properties with expressions (such as a data binding), the current value of the expression is copied but not the expression itself.

If the object has animated dependency properties, the current animated value of those properties is copied, but the animations are not.

Note that unset properties are not copied, nor are read-only properties. If such a property has a default value that is a frozen Freezable, that property value remains frozen in the otherwise modifiable clone.

The following list summarizes the expected behavior for this method.

  • The copy produced contains copies of all Freezable sub-objects.

  • Unset and read-only properties are not copied.

  • If a property is animated, its current value is copied, but the animation itself is not.

  • None of these sub-objects are frozen on creation.

  • The copy itself is not frozen.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.