TypeExtension 类

定义

实现根据字符串输入返回 Type 的标记扩展。Implements a markup extension that returns a Type based on a string input.

public ref class TypeExtension : System::Windows::Markup::MarkupExtension
[System.ComponentModel.TypeConverter(typeof(System.Windows.Markup.TypeExtensionConverter))]
[System.Windows.Markup.MarkupExtensionReturnType(typeof(System.Type))]
public class TypeExtension : System.Windows.Markup.MarkupExtension
type TypeExtension = class
    inherit MarkupExtension
Public Class TypeExtension
Inherits MarkupExtension
继承
TypeExtension
属性

注解

有关 XAMLXAML 用法信息,请参阅X:Type 标记扩展For XAMLXAML usage information, see x:Type Markup Extension.

备注

{x:Type} 功能通常适用于标记中的用户代码调用。The {x:Type} functionality is generally for user code invocation from markup. 对于实现 XAML 支持的代码,类型解析服务来自 IXamlTypeResolver,并与操作 XAML 架构上下文的实现相关。For code that is implementing XAML support, type resolution services come from IXamlTypeResolver and are related to the implementation of the acting XAML schema context. 不要尝试引用 ProvideValue 作为 IXamlTypeResolver 服务提供程序的替代方案;传入的上下文可能对类型解析无效,尝试在没有有效服务的情况下调用将失败。Do not attempt to reference ProvideValue as a substitute for a IXamlTypeResolver service provider; the context you pass in might not be valid for a type resolution, and attempts to call without valid services will fail.

WPF 使用说明WPF Usage Notes

当 XAML 引用这些功能时,类型引用通常用于 WPFWPF中的样式、模板和数据绑定功能区。Type references are commonly used for style, template, and databinding feature areas in WPFWPF, when these features are referenced by XAML.

构造函数

TypeExtension()

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

TypeExtension(String)

根据所提供的 TypeExtension 字符串初始化 TypeName 值,从而初始化 typeName 类的新实例。Initializes a new instance of the TypeExtension class, initializing the TypeName value based on the provided typeName string.

TypeExtension(Type)

初始化 TypeExtension 类的新实例,直接声明类型。Initializes a new instance of the TypeExtension class, declaring the type directly.

属性

Type

获取或设置此扩展的类型信息。Gets or sets the type information for this extension.

TypeName

获取或设置此标记扩展所表示的类型名称。Gets or sets the type name represented by this markup extension.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

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

(继承自 Object)
MemberwiseClone()

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

(继承自 Object)
ProvideValue(IServiceProvider)

返回一个应在应用了此扩展的属性上设置的对象。Returns an object that should be set on the property where this extension is applied. 对于 TypeExtension,这是为请求的类型名称计算的 Type 值。For TypeExtension , this is the Type value as evaluated for the requested type name.

ToString()

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

(继承自 Object)

适用于

另请参阅