ContentWrapperAttribute Class

Definition

指定将用于包装外部内容的关联集合类型的一个或多个类型。Specifies one or more types on the associated collection type that will be used to wrap foreign content.

public ref class ContentWrapperAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)]
public sealed class ContentWrapperAttribute : Attribute
type ContentWrapperAttribute = class
    inherit Attribute
Public NotInheritable Class ContentWrapperAttribute
Inherits Attribute
Inheritance
ContentWrapperAttribute
Attributes

Remarks

"外部内容" 指的是对内容属性类型的类型系统约束不会捕获所属类型的 XAML 使用情况支持的所有可能的内容事例。Foreign content refers to cases where the type system constraints on the type of the content property do not capture all of the possible content cases that XAML usage for the owning type would support. 例如,XAML 支持特定类型的内容可能支持强类型化泛型 Collection<T>中的字符串。For example, XAML support for content of a particular type might support strings in a strongly typed generic Collection<T>.

InlineCollection 是应用了 ContentWrapperAttribute 特性的 WPFWPF 类的示例。InlineCollection is an example of a WPFWPF class that has the ContentWrapperAttribute attribute applied. 在此示例中,有两个单独的属性化包装类。In this case there are two separate attributed wrapper classes.

在 .NET Framework 的以前版本中,此类存在于 WPF 特定的程序集 WindowsBase 中。In previous versions of the .NET Framework, this class existed in the WPF-specific assembly WindowsBase. .NET Framework 4.NET Framework 4中,ContentWrapperAttribute 在 system.exception 程序集中。In .NET Framework 4.NET Framework 4, ContentWrapperAttribute is in the System.Xaml assembly. 有关详细信息,请参阅 Types Migrated from WPF to System.XamlFor more information, see Types Migrated from WPF to System.Xaml.

Constructors

ContentWrapperAttribute(Type)

初始化 ContentWrapperAttribute 类的新实例。Initializes a new instance of the ContentWrapperAttribute class.

Properties

ContentWrapper

获取作为与此特性关联的集合类型的内容包装声明的类型。Gets the type that is declared as a content wrapper for the collection type associated with this attribute.

TypeId

获取此特性的唯一标识符。Gets a unique identifier for this attribute.

Methods

Equals(Object)

通过比较 ContentWrapper 属性确定指定的 ContentWrapperAttribute 是否等效于此 ContentWrapperAttributeDetermines whether the specified ContentWrapperAttribute is equivalent this ContentWrapperAttribute by comparing the ContentWrapper properties.

GetHashCode()

获取此实例的哈希代码。Gets a hash code for this instance.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
IsDefaultAttribute()

在派生类中重写时,指示此实例的值是否是派生类的默认值。When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Inherited from Attribute)
Match(Object)

当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Inherited from Attribute)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

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

将一组名称映射为对应的一组调度标识符。Maps a set of names to a corresponding set of dispatch identifiers.

(Inherited from Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,然后可以使用该信息获取接口的类型信息。Retrieves the type information for an object, which can be used to get the type information for an interface.

(Inherited from Attribute)
_Attribute.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Inherited from Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对某一对象公开的属性和方法的访问。Provides access to properties and methods exposed by an object.

(Inherited from Attribute)

Applies to

See also