ContentWrapperAttribute 类

定义

指定将用于包装外部内容的关联集合类型的一个或多个类型。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
继承
ContentWrapperAttribute
属性

注解

"外部内容" 指的是对内容属性类型的类型系统约束不会捕获所属类型的 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是应用了该WPFWPF ContentWrapperAttribute特性的类的示例。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 4ContentWrapperAttribute , 为 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.

构造函数

ContentWrapperAttribute(Type)

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

属性

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.

方法

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.

(继承自 Object)
IsDefaultAttribute()

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

(继承自 Attribute)
Match(Object)

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

(继承自 Attribute)
MemberwiseClone()

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

(继承自 Object)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

显式界面实现

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

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

(继承自 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.

(继承自 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

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

(继承自 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

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

(继承自 Attribute)

适用于

另请参阅