Freezable.GetCurrentValueAsFrozenCore(Freezable) 方法


將目前執行個體設為所指定 Freezable 的凍結複製品。Makes the current instance a frozen clone of the specified Freezable. 如果物件具有動畫相依性屬性,則會複製其目前的動畫值。If the object has animated dependency properties, their current animated values are copied.

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



要複製和凍結的 FreezableThe Freezable to copy and freeze.


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

將所有資料儲存在相依性屬性中,而且不需要執行額外初始化工作的類別,不需要覆寫 GetCurrentValueAsFrozenCore(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 GetCurrentValueAsFrozenCore(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. 預設的執行會使用 CreateInstance() 方法建立新的 Freezable,並製作其所包含之所有其他可寫入之本機 set 屬性的未凍結 freezable 和淺層複本的深層複本。The default implementation creates a new Freezable using the CreateInstance() method and makes deep copies of unfrozen freezables and shallow copies of all other writable, locally set properties it contains. 如果物件具有資料系結的相依性屬性,則會複製資料系結,但可能無法再解析。如需複製資料系結物件的詳細資訊,請參閱可凍結物件總覽If the object has data-bound dependency properties, the data bindings 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 current animated value of those properties is copied, but the animations are not.

這個預設的實值不會複製 Freezable 內的唯讀相依性屬性。Read-only dependency properties within a Freezable are not copied by this default implementation.

如果您覆寫這個方法,就必須呼叫基底實作為。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.