Freezable.CloneCurrentValueCore(Freezable) Freezable.CloneCurrentValueCore(Freezable) Freezable.CloneCurrentValueCore(Freezable) Freezable.CloneCurrentValueCore(Freezable) Method

定义

使用当前属性值使该实例成为指定 Freezable 的可修改克隆(深层复制)。Makes the instance a modifiable clone (deep copy) of the specified Freezable using current property values.

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

参数

sourceFreezable
Freezable Freezable Freezable Freezable

要克隆的 FreezableThe Freezable to be cloned.

注解

此方法由CloneCurrentValue方法调用, 不应在代码中直接调用, 除非在重写此方法时调用基实现。This method is called by the CloneCurrentValue method and should not be called directly from your code, except when calling the base implementation while overriding this method. 若要创建当前对象的可修改副本, 请CloneCurrentValue调用, 而不是直接调用此方法。To create a modifiable copy of the current object, call CloneCurrentValue 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.

将其所有数据存储在依赖属性中并且无需执行额外的初始化工作的类不需要重写CloneCurrentValueCore(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 CloneCurrentValueCore(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. 如果对象包含具有表达式 (如数据绑定) 的依赖项属性, 则会复制该表达式的当前值, 而不是表达式本身。If the object contains dependency properties with expressions (such as a data binding), the current value of the expression is copied but not the expression itself.

如果对象具有动画依赖属性, 则会复制这些属性的当前动画值, 但不会复制动画。If the object has animated dependency properties, the current animated value of those properties is copied, but the animations are not.

请注意, 不会复制未设置的属性, 也不会为只读属性。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 和只读属性。- Unset and read-only properties are not copied.

-如果对属性进行动画处理, 则会复制其当前值, 但不会复制动画本身。- If a property is animated, its current value is copied, but the animation itself is not.

-在创建时这些子对象均不会被冻结。- None of these sub-objects are frozen on creation.

-副本本身未冻结。- The copy itself is not frozen.

适用于

另请参阅