Freezable.GetCurrentValueAsFrozenCore(Freezable) Freezable.GetCurrentValueAsFrozenCore(Freezable) Freezable.GetCurrentValueAsFrozenCore(Freezable) Freezable.GetCurrentValueAsFrozenCore(Freezable) Method

定義

將目前執行個體設為所指定 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.

protected:
 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)

參數

sourceFreezable
Freezable Freezable Freezable 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. 預設的執行會Freezable CreateInstance()使用方法建立新的, 並製作未凍結 freezable 的深層複本, 以及它所包含的所有其他可寫入之本機 set 屬性的淺層複本。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.

適用於

另請參閱