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(). 例如,这适用于你的派生的类实现ISupportInitializeFor 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. 有关克隆数据绑定对象的详细信息,请参阅Freezable 对象概述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 这些子对象的已冻结上创建。- 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.

适用于

另请参阅