Freezable.CloneCore(Freezable) Freezable.CloneCore(Freezable) Freezable.CloneCore(Freezable) Freezable.CloneCore(Freezable) Method

定義

使用基底 (非動畫) 屬性值,將執行個體設為指定 Freezable 的複製品 (深層複製)。Makes the instance a clone (deep copy) of the specified Freezable using base (non-animated) property values.

protected:
 virtual void CloneCore(System::Windows::Freezable ^ sourceFreezable);
protected virtual void CloneCore (System.Windows.Freezable sourceFreezable);
abstract member CloneCore : System.Windows.Freezable -> unit
override this.CloneCore : System.Windows.Freezable -> unit
Protected Overridable Sub CloneCore (sourceFreezable As Freezable)

參數

sourceFreezable
Freezable Freezable Freezable Freezable

要複製的物件。The object to clone.

備註

這個方法是由Clone方法呼叫, 不應直接從您的程式碼呼叫, 除非在覆寫這個方法時呼叫基底執行。This method is called by the Clone method and should not be called directly from your code, except when calling the base implementation while overriding this method. 若要建立目前物件的可修改複本, 請Clone呼叫, 而不是直接呼叫這個方法。To create a modifiable copy of the current object, call Clone instead of calling this method directly.

給繼承者的注意事項

如果您衍生自Freezable, 您可能需要覆寫此方法。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.

-您的衍生類別必須執行額外的初始化工作, 而不只是CreateInstanceCore()覆寫來完成。- Your derived class must perform extra initialization work that cannot be accomplished by simply overriding CreateInstanceCore(). 例如, 如果您的衍生類別ISupportInitialize已執行, 這就適用。For example, this applies if your derived class implements ISupportInitialize.

將所有資料儲存在相依性屬性中, 而且不需要執行額外初始化工作的類別, 不需要覆寫CloneCore(Freezable)Classes that store all their data in dependency properties and that do not need to perform extra initialization work do not need to override CloneCore(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. 如果這類屬性的預設值是凍結Freezable的, 則該屬性值在其他可修改的複本中會保持凍結。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: -產生的複本包含所有Freezable子物件的複本。- The copy produced contains copies of all 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.

適用於

另請參閱