NameScopePropertyAttribute 類別

定義

指定提供 XAML NameScope 值之相關聯類別的屬性。

public ref class NameScopePropertyAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=true)]
public sealed class NameScopePropertyAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=true)>]
type NameScopePropertyAttribute = class
    inherit Attribute
Public NotInheritable Class NameScopePropertyAttribute
Inherits Attribute
繼承
NameScopePropertyAttribute
屬性

備註

在使用 XAML 的一般物件模型/應用程式模型組合中,做為 XAML 命名範圍的類別是通常用來做為根元素的類別,或是支援頁面隱喻的類別。 這些類別通常會實 INameScope 作,而且 XAML 命名範圍是透過架構程式設計模型和應用程式模型內容中的一般 XAML 處理行為,來建立對應至根目錄。

如果使用 NameScopePropertyAttribute ,XAML namescope 屬性值必須是實 INameScope 作並保存實際 XAML 命名範圍及其行為的物件。

此屬性有兩種形式:僅限屬性名稱,或類型與屬性。 第二個表單應該只用於保存 XAML 名稱範圍的屬性是可附加成員的情況。 附加成員技術的優點是服務類別可以實作 XAML 命名範圍概念,以支援數種不同的物件類型。 然後,這些物件類型不需要在類別繼承中明確相關。

在舊版的 .NET Framework 中,這個類別存在於 WPF 特定的元件 WindowsBase 中。 在 .NET Framework 4 中,NameScopePropertyAttribute位於 System.Xaml 元件中。 如需詳細資訊,請參閱 Types Migrated from WPF to System.Xaml

WPF 使用注意事項

在 WPF 中,此屬性只會套用至單一類型 DependencyObject 在此情況下,屬性化屬性是服務類別 NameScope 及其 NameScope.NameScope 附加屬性。

建構函式

NameScopePropertyAttribute(String)

使用指定的名稱,初始化 NameScopePropertyAttribute 類別的新執行個體。

NameScopePropertyAttribute(String, Type)

初始化具有指定的名稱和類型之 NameScopePropertyAttribute 類別的新執行個體。

屬性

Name

取得提供 XAML 名稱範圍的屬性名稱。

Type

取得提供 XAML 名稱範圍支援之附加屬性的擁有者類型。

TypeId

在衍生類別中實作時,取得這個 Attribute 的唯一識別碼。

(繼承來源 Attribute)

方法

Equals(Object)

傳回值,這個值指出此執行個體是否與指定的物件相等。

(繼承來源 Attribute)
GetHashCode()

傳回這個執行個體的雜湊碼。

(繼承來源 Attribute)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IsDefaultAttribute()

在衍生類別中覆寫時,表示這個執行個體的值是衍生類別的預設值。

(繼承來源 Attribute)
Match(Object)

在衍生類別中覆寫時,會傳回值,表示這個執行個體是否等於指定物件。

(繼承來源 Attribute)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

明確介面實作

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。

(繼承來源 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

擷取物件的類型資訊,可以用來取得介面的類型資訊。

(繼承來源 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

擷取物件提供的類型資訊介面數目 (0 或 1)。

(繼承來源 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供物件所公開的屬性和方法的存取權。

(繼承來源 Attribute)

適用於

另請參閱