DependsOnAttribute 類別
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示屬性化屬性與另一個屬性的值相依。
public ref class DependsOnAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Property, AllowMultiple=true)]
public sealed class DependsOnAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Property, AllowMultiple=true)>]
type DependsOnAttribute = class
inherit Attribute
Public NotInheritable Class DependsOnAttribute
Inherits Attribute
- 繼承
- 屬性
上的 SaveXamlWriter 方法會先處理指定的屬性,再處理此屬性設定所在的屬性。
name
套用至此屬性的值必須是存在於相同類型之屬性的簡單不限定名稱。 您無法將附加屬性指定為相依性。
套用此屬性時,請務必小心以避免迴圈相依性。 只有在已寫入迴圈中的所有屬性時,才會偵測迴圈相依性,即使行為不具決定性亦然。
將此屬性套用至屬性定義可確保先在 XAML 物件寫入中處理相依屬性。 它是 XAML 標記的一般規則的一部分,針對所建立物件套用的屬性值應該能夠依任何順序處理。 的使用方式 DependsOnAttribute 會指定類型上的例外狀況,其中必須遵循特定剖析順序才能建立有效的物件。
在舊版的 .NET Framework 中,這個類別存在於 WPF 特定的元件 WindowsBase 中。 在 .NET Framework 4 中,DependsOnAttribute位於 System.Xaml 元件中。 如需詳細資訊,請參閱 Types Migrated from WPF to System.Xaml。
類別 Value 上的 Setter 屬性是 WPF DependsOnAttribute 中套用屬性的屬性範例。 Value 相依於 Property 並 TargetName 先處理,否則無法知道應該針對值轉換器案例建立何種類型。
Depends |
初始化 DependsOnAttribute 類別的新執行個體。 |
Name |
取得這個 DependsOnAttribute 中所宣告之相關屬性的名稱。 |
Type |
取得這個 DependsOnAttribute 的唯一識別項。 |
Equals(Object) |
傳回值,這個值指出此執行個體是否與指定的物件相等。 (繼承來源 Attribute) |
Get |
傳回這個執行個體的雜湊碼。 (繼承來源 Attribute) |
Get |
取得目前執行個體的 Type。 (繼承來源 Object) |
Is |
在衍生類別中覆寫時,表示這個執行個體的值是衍生類別的預設值。 (繼承來源 Attribute) |
Match(Object) |
在衍生類別中覆寫時,會傳回值,表示這個執行個體是否等於指定物件。 (繼承來源 Attribute) |
Memberwise |
建立目前 Object 的淺層複製。 (繼承來源 Object) |
To |
傳回代表目前物件的字串。 (繼承來源 Object) |
_Attribute. |
將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。 (繼承來源 Attribute) |
_Attribute. |
擷取物件的類型資訊,可以用來取得介面的類型資訊。 (繼承來源 Attribute) |
_Attribute. |
擷取物件提供的類型資訊介面數目 (0 或 1)。 (繼承來源 Attribute) |
_Attribute. |
提供物件所公開的屬性和方法的存取權。 (繼承來源 Attribute) |
產品 | 版本 |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |