Cet article a fait l’objet d’une traduction automatique. Pour afficher l’article en anglais, activez la case d’option Anglais. Vous pouvez également afficher le texte anglais dans une fenêtre contextuelle en faisant glisser le pointeur de la souris sur le texte traduit.
Traduction
Anglais

Freezable.CloneCore méthode (Freezable)

 

Date de publication : novembre 2016

Fait de l’instance un clone (copie complète) du Freezable spécifié utilisant des valeurs de propriété (non animée) de base.

Espace de noms:   System.Windows
Assembly:  WindowsBase (dans WindowsBase.dll)

protected virtual void CloneCore(
	Freezable sourceFreezable
)

Paramètres

sourceFreezable
Type: System.Windows.Freezable

Objet à cloner.

This method is called by the M:System.Windows.Freezable.Clone 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 M:System.Windows.Freezable.Clone instead of calling this method directly.

Remarques à l’attention des héritiers :

If you derive from T:System.Windows.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 M:System.Windows.Freezable.CreateInstanceCore. For example, this applies if your derived class implements T:System.ComponentModel.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 M:System.Windows.Freezable.CloneCore(System.Windows.Freezable).

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, including internal expressions.

If the object has data-bound dependency properties, the expressions are copied but might no longer resolve. For more information about cloning data-bound objects, see Freezable Objects Overview. If the object has animated dependency properties, the base (non-animated) value of those properties is copied. Animations are not copied.

Note that unset properties are not copied, nor are read-only properties. If such a property has a default value that is a frozen T:System.Windows.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 T:System.Windows.Freezable sub-objects.

  • Unset and read-only properties are not copied.

  • Expressions are copied.

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

  • The copy itself is not frozen.

  • Animations are not copied.

  • Only property base values are copied, not current animated values.

.NET Framework
Disponible depuis 3.0
Retour au début
Afficher: