Freezable.CloneCurrentValue 方法

定義

使用 Freezable 的目前值,建立它的可修改複製品 (深層複本)。Creates a modifiable clone (deep copy) of the Freezable using its current values.

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

傳回

目前物件的可修改複本。A modifiable clone of the current object. 即使來源的 IsFrozen 屬性為 true.,複製物件的 IsFrozen 屬性仍為 falseThe cloned object's IsFrozen property is false even if the source's IsFrozen property is true.

備註

CloneCloneCurrentValue 方法會產生凍結 Freezable 物件的可修改複本(方法也會複製未凍結的 Freezable 物件)。The Clone and CloneCurrentValue methods produce modifiable clones of frozen Freezable objects (the methods also clone Freezable objects that are not frozen). 複製實際上是目前物件的深層複本。The clone is effectively a deep copy of the current object.

下表摘要說明 CloneCloneCurrentValue 方法之間的差異。The following table summarizes the differences between the Clone and CloneCurrentValue methods.

動作Action 複製方法行為Clone method behavior CloneCurrentValue 方法行為CloneCurrentValue method behavior
複製具有運算式的相依性屬性Copying a dependency property that has an expression 運算式已複製,但可能無法再解析。The expression is copied, but might no longer resolve. 如需詳細資訊,請參閱 Freezable 物件概觀For more information, see Freezable Objects Overview. 運算式的目前值已複製,而不是運算式本身。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. 如果未設定的屬性具有預設值,而這是凍結的 Freezable,該屬性值就會在其他可修改的複本中維持凍結狀態。If an unset property has a default value that is a frozen Freezable, that property value remains frozen in the otherwise modifiable clone.

線上程之間移動能凍結的Move a Freezable Between Threads

這個方法有助於線上程之間移動 FreezableThis method can be useful for moving a Freezable between threads. 首先,使用其 Freeze 方法,使 Freezable 無法修改。First, make the Freezable unmodifiable by using its Freeze method. 現在,另一個執行緒可以存取 Freezable,並建立可存取的本機複本。Now another thread can access the Freezable and make a local clone that it can access.

給繼承者的注意事項

這個方法會使用 CloneCurrentValueCore(Freezable) 方法來產生複製;覆寫 CloneCurrentValueCore(Freezable)Freezable 實施者必須確保複製不會在建立時凍結。This method uses the CloneCurrentValueCore(Freezable) method to produce the clone; Freezable implementers who override CloneCurrentValueCore(Freezable) must ensure that the copy is not frozen on creation.

適用於

另請參閱