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. 默认实现为其包含的所有其他可写的本地设置属性生成任何未冻结的可冻结对象和浅层副本的深层副本。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