Freezable.GetCurrentValueAsFrozen Freezable.GetCurrentValueAsFrozen Freezable.GetCurrentValueAsFrozen Freezable.GetCurrentValueAsFrozen Method


使用当前属性值创建 Freezable 的冻结副本。Creates a frozen copy of the Freezable using current property values. 由于副本已冻结,因此将通过引用复制任何冻结的子对象。Because the copy is frozen, any frozen sub-objects are copied by reference.

 System::Windows::Freezable ^ GetCurrentValueAsFrozen();
public System.Windows.Freezable GetCurrentValueAsFrozen ();
member this.GetCurrentValueAsFrozen : unit -> System.Windows.Freezable
Public Function GetCurrentValueAsFrozen () As Freezable


Freezable 的冻结副本。A frozen copy of the Freezable. 副本的 IsFrozen 属性设置为 trueThe copy's IsFrozen property is set to true.


使用此方法类似于使用CloneCurrentValue创建副本, 然后使用方法将Freeze其冻结。Using this method is similar to creating a copy using the CloneCurrentValue and then freezing it with the Freeze method.

和方法可以提高复制性能, 因为它们不克隆Freezable已经冻结的子对象; 它们只按引用复制它们。 GetCurrentValueAsFrozen GetAsFrozenThe GetAsFrozen and GetCurrentValueAsFrozen methods can improve copying performance because they do not clone Freezable sub-objects that are already frozen; they only copy them by reference.

下表总结了GetAsFrozenGetCurrentValueAsFrozen方法之间的差异。The following table summarizes the differences between the GetAsFrozen and GetCurrentValueAsFrozen methods.

操作Action GetAsFrozen 方法行为GetAsFrozen method behavior GetCurrentValueAsFrozen 方法行为GetCurrentValueAsFrozen method behavior
复制具有表达式的依赖项属性Copying a dependency property that has an expression 方法引发, InvalidOperationException因为它不能Freeze是属性。The method throws an InvalidOperationException because it cannot Freeze the property. 复制表达式的当前值, 而不是表达式本身。The current value of the expression is copied, but not the expression itself.
复制动画依赖属性Copying an animated dependency property 复制属性的基 (未经过动画处理的) 值。The property's base (non-animated) value is copied. 不复制动画。Animations are not copied. 复制属性的当前动画值。The property's current animated value is copied. 不复制动画。Animations are not copied.

请注意, 不会复制未设置的属性, 也不会为只读属性。Note that unset properties are not copied, nor are read-only properties.

若要创建未冻结的Freezable副本, 请CloneCurrentValue使用方法。To create a copy of the Freezable that is not frozen, use the CloneCurrentValue method.


此方法使用虚GetCurrentValueAsFrozenCore(Freezable)方法来生成克隆。This method uses the virtual GetCurrentValueAsFrozenCore(Freezable) method to produce the clone.