Freezable.GetAsFrozenCore(Freezable) Method


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

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



要複製的執行個體。The instance to copy.


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

Notes to Inheritors

如果您衍生自 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.

將所有資料儲存在相依性屬性中,而且不需要執行額外初始化工作的類別,不需要覆寫 GetAsFrozenCore(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 GetAsFrozenCore(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. 預設的執行會製作任何未凍結 freezable 的深層複本,以及它所包含的所有其他可寫入之本機 set 屬性的淺層複本。The default implementation makes deep copies of any unfrozen freezables and shallow copies of all other writable, locally set properties it contains. 如果物件具有資料系結的相依性屬性,則會複製運算式,但可能不再解析;如需複製資料系結物件的詳細資訊,請參閱可凍結物件總覽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) values of those properties are copied. 不會複製動畫。Animations are not copied.

請注意,不會複製未設定的屬性,也不會有唯讀屬性。Note that unset properties are not copied, nor are read-only properties.

如果您覆寫這個方法,就必須呼叫基底實作為。If you do override this method, you must call the base implementation.

您不需要在複製時 Freeze() 值。You do not need to Freeze() values as they are copied. 結果會在傳回之前 GetAsFrozen() 凍結。The result is frozen by GetAsFrozen() before being returned.

Applies to

See also