Freezable Freezable Freezable Freezable Class

定義

定義具有可修改狀態和唯讀 (凍結) 狀態的物件。 Defines an object that has a modifiable state and a read-only (frozen) state. 衍生自 Freezable 的類別可以提供詳細變更告知、可以設為不變的,而且可以自我複製。 Classes that derive from Freezable provide detailed change notification, can be made immutable, and can clone themselves.

public ref class Freezable abstract : System::Windows::DependencyObject
public abstract class Freezable : System.Windows.DependencyObject
type Freezable = class
    inherit DependencyObject
Public MustInherit Class Freezable
Inherits DependencyObject
繼承
衍生

備註

Freezable類別會提供特殊功能,可協助改善應用程式效能,使用很難修改或複製的物件時。The Freezable class provides special features that can help improve application performance when using objects that are expensive to modify or copy. 範例Freezable物件包括下列:Examples of Freezable objects include the following:

衍生自 FreezableDeriving From Freezable

類別衍生自Freezable獲得下列功能:A class that derives from Freezable gains the following features:

  • 特殊的狀態: 唯讀 (凍結) 狀態和可寫入狀態。Special states: a read-only (frozen) state and a writable state.

  • 執行緒安全: 凍結Freezable可以跨執行緒共用物件。Thread safety: a frozen Freezable object can be shared across threads.

  • 詳細的變更通知: 不同於其他DependencyObject物件,Freezable子屬性值變更時,物件會提供變更通知。Detailed change notification: Unlike other DependencyObject objects, a Freezable object provides change notifications when sub-property values change.

  • 輕鬆複製: Freezable 的類別已實作數種方法,產生深層複製品。Easy cloning: the Freezable class has already implemented several methods that produce deep clones.

如需有關使用和建立您自己Freezable物件,請參閱Freezable 物件概觀For information on using and creating your own Freezable objects, see Freezable Objects Overview.

建構函式

Freezable() Freezable() Freezable() Freezable()

初始化 Freezable 衍生類別的新執行個體。 Initializes a new instance of a Freezable derived class.

屬性

CanFreeze CanFreeze CanFreeze CanFreeze

取得值,指出是否可以將物件設為不可修改。 Gets a value that indicates whether the object can be made unmodifiable.

DependencyObjectType DependencyObjectType DependencyObjectType DependencyObjectType

取得包裝此執行個體之 CLRCLR 型別的 DependencyObjectType Gets the DependencyObjectType that wraps the CLRCLR type of this instance.

(Inherited from DependencyObject)
Dispatcher Dispatcher Dispatcher Dispatcher

取得與這個 Dispatcher 關聯的 DispatcherObject Gets the Dispatcher this DispatcherObject is associated with.

(Inherited from DispatcherObject)
IsFrozen IsFrozen IsFrozen IsFrozen

取得值,該值表示物件目前是否可修改。 Gets a value that indicates whether the object is currently modifiable.

IsSealed IsSealed IsSealed IsSealed

取得值,這個值表示此執行個體目前是否已密封 (唯讀)。 Gets a value that indicates whether this instance is currently sealed (read-only).

(Inherited from DependencyObject)

方法

CheckAccess() CheckAccess() CheckAccess() CheckAccess()

判斷呼叫的執行是否可以存取這個 DispatcherObject Determines whether the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)
ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty)

清除屬性的區域數值。 Clears the local value of a property. 要清除的屬性是由 DependencyProperty 識別項所指定。 The property to be cleared is specified by a DependencyProperty identifier.

(Inherited from DependencyObject)
ClearValue(DependencyPropertyKey) ClearValue(DependencyPropertyKey) ClearValue(DependencyPropertyKey) ClearValue(DependencyPropertyKey)

清除唯讀屬性的區域數值。 Clears the local value of a read-only property. 要清除的屬性是由 DependencyPropertyKey 所指定。 The property to be cleared is specified by a DependencyPropertyKey.

(Inherited from DependencyObject)
Clone() Clone() Clone() Clone()

建立這個 Freezable 的可修改複製,製作這個物件值的深層複製。 Creates a modifiable clone of the Freezable, making deep copies of the object's values. 當複製這個物件的相依性屬性時,這個方法會複製運算式 (但可能已不再解析),但不會複製動畫或其目前值。 When copying the object's dependency properties, this method copies expressions (which might no longer resolve) but not animations or their current values.

CloneCore(Freezable) CloneCore(Freezable) CloneCore(Freezable) CloneCore(Freezable)

使用基底 (非動畫) 屬性值,將執行個體設為指定 Freezable 的複製品 (深層複製)。 Makes the instance a clone (deep copy) of the specified Freezable using base (non-animated) property values.

CloneCurrentValue() CloneCurrentValue() CloneCurrentValue() CloneCurrentValue()

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

CloneCurrentValueCore(Freezable) CloneCurrentValueCore(Freezable) CloneCurrentValueCore(Freezable) CloneCurrentValueCore(Freezable)

使用目前的屬性值,讓執行個體成為指定之 Freezable 的可修改複本 (深層複本)。 Makes the instance a modifiable clone (deep copy) of the specified Freezable using current property values.

CoerceValue(DependencyProperty) CoerceValue(DependencyProperty) CoerceValue(DependencyProperty) CoerceValue(DependencyProperty)

強制轉型所指定相依性屬性的值。 Coerces the value of the specified dependency property. 叫用存在於呼叫 CoerceValueCallback 上相依性屬性之屬性中繼資料內所指定的任何 DependencyObject 函式,就可以達到這一點。 This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.

(Inherited from DependencyObject)
CreateInstance() CreateInstance() CreateInstance() CreateInstance()

初始化 Freezable 類別的新執行個體。 Initializes a new instance of the Freezable class.

CreateInstanceCore() CreateInstanceCore() CreateInstanceCore() CreateInstanceCore()

在衍生類別中實作時,建立 Freezable 衍生類別的新執行個體。 When implemented in a derived class, creates a new instance of the Freezable derived class.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷提供的 DependencyObject 和目前的 DependencyObject 是否相等。 Determines whether a provided DependencyObject is equivalent to the current DependencyObject.

(Inherited from DependencyObject)
Freeze() Freeze() Freeze() Freeze()

將目前物件設為不可修改的,並將它的 IsFrozen 屬性設定為 true Makes the current object unmodifiable and sets its IsFrozen property to true.

Freeze(Freezable, Boolean) Freeze(Freezable, Boolean) Freeze(Freezable, Boolean) Freeze(Freezable, Boolean)

如果 isChecking 參數是 true,則這個方法表示是否可以將指定的 Freezable 設為不可修改的。 If the isChecking parameter is true, this method indicates whether the specified Freezable can be made unmodifiable. 如果 isChecking 參數是 false,則這個方法會嘗試將指定的 Freezable 設為不可修改的,並表示作業是否成功。 If the isChecking parameter is false, this method attempts to make the specified Freezable unmodifiable and indicates whether the operation succeeded.

FreezeCore(Boolean) FreezeCore(Boolean) FreezeCore(Boolean) FreezeCore(Boolean)

Freezable 物件設為不可修改的,或測試是否可以將它設為不可修改的。 Makes the Freezable object unmodifiable or tests whether it can be made unmodifiable.

GetAsFrozen() GetAsFrozen() GetAsFrozen() GetAsFrozen()

使用基底 (非動畫) 屬性值,建立 Freezable 的凍結複本。 Creates a frozen copy of the Freezable, using base (non-animated) property values. 因為複本已凍結,所以會以傳址方式複製任何凍結子物件。 Because the copy is frozen, any frozen sub-objects are copied by reference.

GetAsFrozenCore(Freezable) GetAsFrozenCore(Freezable) GetAsFrozenCore(Freezable) GetAsFrozenCore(Freezable)

使用基底 (非動畫) 屬性值,將執行個體設為所指定 Freezable 的凍結複製品。 Makes the instance a frozen clone of the specified Freezable using base (non-animated) property values.

GetCurrentValueAsFrozen() GetCurrentValueAsFrozen() GetCurrentValueAsFrozen() GetCurrentValueAsFrozen()

使用目前屬性值,建立 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.

GetCurrentValueAsFrozenCore(Freezable) GetCurrentValueAsFrozenCore(Freezable) GetCurrentValueAsFrozenCore(Freezable) GetCurrentValueAsFrozenCore(Freezable)

將目前執行個體設為所指定 Freezable 的凍結複製品。 Makes the current instance a frozen clone of the specified Freezable. 如果物件具有動畫相依性屬性,則會複製其目前的動畫值。 If the object has animated dependency properties, their current animated values are copied.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

取得這個 DependencyObject 的雜湊程式碼。 Gets a hash code for this DependencyObject.

(Inherited from DependencyObject)
GetLocalValueEnumerator() GetLocalValueEnumerator() GetLocalValueEnumerator() GetLocalValueEnumerator()

建立特定的列舉值,以判斷哪些相依性屬性在此 DependencyObject 上具有本機設定的值。 Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject.

(Inherited from DependencyObject)
GetType() GetType() GetType() GetType()

取得目前執行個體的 Type Gets the Type of the current instance.

(Inherited from Object)
GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty)

傳回 DependencyObject 的這個執行個體上之相依性屬性的目前有效值。 Returns the current effective value of a dependency property on this instance of a DependencyObject.

(Inherited from DependencyObject)
InvalidateProperty(DependencyProperty) InvalidateProperty(DependencyProperty) InvalidateProperty(DependencyProperty) InvalidateProperty(DependencyProperty)

重新評估指定之相依性屬性的有效值。 Re-evaluates the effective value for the specified dependency property

(Inherited from DependencyObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。 Creates a shallow copy of the current Object.

(Inherited from Object)
OnChanged() OnChanged() OnChanged() OnChanged()

修改目前 Freezable 物件時進行呼叫。 Called when the current Freezable object is modified.

OnFreezablePropertyChanged(DependencyObject, DependencyObject) OnFreezablePropertyChanged(DependencyObject, DependencyObject) OnFreezablePropertyChanged(DependencyObject, DependencyObject) OnFreezablePropertyChanged(DependencyObject, DependencyObject)

確定已為剛剛設定的 DependencyObjectType 資料成員,建立適當的內容指標。 Ensures that appropriate context pointers are established for a DependencyObjectType data member that has just been set.

OnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty) OnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty) OnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty) OnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty)

這個成員支援 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基礎結構,但是您不可以從程式碼直接使用它。 This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

OnPropertyChanged(DependencyPropertyChangedEventArgs) OnPropertyChanged(DependencyPropertyChangedEventArgs) OnPropertyChanged(DependencyPropertyChangedEventArgs) OnPropertyChanged(DependencyPropertyChangedEventArgs)

覆寫 OnPropertyChanged(DependencyPropertyChangedEventArgs)DependencyObject 實作也可以叫用任何 Changed 處理常式,以回應類型 Freezable 的變更相依性屬性。 Overrides the DependencyObject implementation of OnPropertyChanged(DependencyPropertyChangedEventArgs) to also invoke any Changed handlers in response to a changing dependency property of type Freezable.

ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty)

傳回相依性屬性的區域數值 (如果存在)。 Returns the local value of a dependency property, if it exists.

(Inherited from DependencyObject)
ReadPreamble() ReadPreamble() ReadPreamble() ReadPreamble()

確定 Freezable 是從有效的執行緒進行存取。 Ensures that the Freezable is being accessed from a valid thread. 如果 APIAPI 會讀取非相依性屬性的資料成員,則 Freezable 的繼承者必須在該 API 的開頭呼叫這個方法。 Inheritors of Freezable must call this method at the beginning of any APIAPI that reads data members that are not dependency properties.

SetCurrentValue(DependencyProperty, Object) SetCurrentValue(DependencyProperty, Object) SetCurrentValue(DependencyProperty, Object) SetCurrentValue(DependencyProperty, Object)

設定相依性屬性的值,而不需要變更其值來源。 Sets the value of a dependency property without changing its value source.

(Inherited from DependencyObject)
SetValue(DependencyProperty, Object) SetValue(DependencyProperty, Object) SetValue(DependencyProperty, Object) SetValue(DependencyProperty, Object)

設定相依性屬性的本機值 (由相依性屬性的識別項所指定)。 Sets the local value of a dependency property, specified by its dependency property identifier.

(Inherited from DependencyObject)
SetValue(DependencyPropertyKey, Object) SetValue(DependencyPropertyKey, Object) SetValue(DependencyPropertyKey, Object) SetValue(DependencyPropertyKey, Object)

設定唯讀相依性屬性的區域數值 (由相依性屬性的 DependencyPropertyKey 識別項所指定)。 Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property.

(Inherited from DependencyObject)
ShouldSerializeProperty(DependencyProperty) ShouldSerializeProperty(DependencyProperty) ShouldSerializeProperty(DependencyProperty) ShouldSerializeProperty(DependencyProperty)

傳回值,這個值表示序列化程序是否應該序列化所提供相依性屬性的值。 Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.

(Inherited from DependencyObject)
ToString() ToString() ToString() ToString()

傳回表示目前物件的字串。 Returns a string that represents the current object.

(Inherited from Object)
VerifyAccess() VerifyAccess() VerifyAccess() VerifyAccess()

請強制執行可以存取這個 DispatcherObject 的呼叫執行緒。 Enforces that the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)
WritePostscript() WritePostscript() WritePostscript() WritePostscript()

引發 ChangedFreezable 事件,並叫用它的 OnChanged() 方法。 Raises the Changed event for the Freezable and invokes its OnChanged() method. 在任何 API 修改未以相依性屬性儲存的類別成員之後,衍生自 Freezable 的類別應該在 API 的結尾呼叫這個方法。 Classes that derive from Freezable should call this method at the end of any API that modifies class members that are not stored as dependency properties.

WritePreamble() WritePreamble() WritePreamble() WritePreamble()

確認 Freezable 未凍結,而且是從有效的執行緒內容進行存取。 Verifies that the Freezable is not frozen and that it is being accessed from a valid threading context. 在任何 APIAPI 將資料寫入至非相依性屬性的資料成員之前,Freezable 繼承者應該在 API 的開頭呼叫這個方法。 Freezable inheritors should call this method at the beginning of any APIAPI that writes to data members that are not dependency properties.

事件

Changed Changed Changed Changed

發生於 Freezable 或所含的物件遭到修改時。 Occurs when the Freezable or an object it contains is modified.

適用於

執行緒安全性

任何公用static這個類型的成員都是安全執行緒。 Any public static members of this type are thread safe. 不保證任何執行個體成員是安全執行緒。 Any instance members are not guaranteed to be thread safe. IsFrozen屬性是falseFreezable只能從其建立所在的執行緒可以存取物件。 When the IsFrozen property is false, a Freezable object can be accessed only from the thread on which it was created. 嘗試從另一個執行緒則會擲回存取InvalidOperationException Attempting to access it from another thread throws an InvalidOperationException. InvokeBeginInvoke方法提供支援封送處理至正確的執行緒。 The Invoke and BeginInvoke methods provide support for marshalling to the correct thread. 當他們IsFrozen屬性是trueFreezable物件都是無限制執行緒。 When their IsFrozen property is true, Freezable objects are free-threaded. 如需詳細資訊,請參閱 Freezable 物件概觀 For more information, see Freezable Objects Overview.