ParserContext 类

定义

提供 XAML 分析器所需的上下文信息。Provides context information required by a XAML parser.

public ref class ParserContext : System::Windows::Markup::IUriContext
public class ParserContext : System.Windows.Markup.IUriContext
type ParserContext = class
    interface IUriContext
Public Class ParserContext
Implements IUriContext
继承
ParserContext
实现

注解

此上下文引用的 xaml 分析器是.NET Framework 3.5.NET Framework 3.5特定于 WPF 实现的纪元 XAML 分析器 API, 如和System.Windows.Markup.XamlWriterSystem.Windows.Markup.XamlReader所示。The XAML parser that this context refers to is the .NET Framework 3.5.NET Framework 3.5 era XAML parser API that is specific to the WPF implementation, as exposed in System.Windows.Markup.XamlReader and System.Windows.Markup.XamlWriter.

.NET Framework 4.NET Framework 4的 xaml 系统使用更复杂的 xaml 类型系统, 因此还为 xaml 处理操作使用不同类型的上下文。The XAML system in .NET Framework 4.NET Framework 4 uses a more sophisticated XAML type system and thus also uses a different type of context for XAML processing operations. 有关详细信息,请参阅 XamlSchemaContextFor more information, see XamlSchemaContext.

通常用作对XamlReader操作的调用的输入。 ParserContextA ParserContext is typically used as an input for a call to a XamlReader operation. 在这些情况下, 你将使用XamlReader.LoadXamlReader.LoadAsync的重载, 其中ParserContext提供对 XAML 的类型映射或更改 XML 处理默认值等因素的更大控制。In these cases, you are using overloads of XamlReader.Load or XamlReader.LoadAsync where supplying the ParserContext provides greater control over factors such as the type mapping to XAML, or altering XML processing defaults. 使用而不是使用System.Windows.Markup.XamlReader默认行为是一种高级方案。 ParserContextUsing a ParserContext as opposed to using System.Windows.Markup.XamlReader default behavior is an advanced scenario.

xml:langxml:space行为是可重写的上下文的一个方面。xml:lang and xml:space behavior is one of the aspects of a context you can override. 默认情况下, 分析器上下文使用en-us基于的值。By default, the parser context uses en-us based values. 有关 XAML 的语言级上下文使用en-us而不是区域性固定值的原因的详细信息, 请参阅WPF 全球化和本地化概述For more information on why the language-level context for XAML uses en-us rather than a culture-invariant value, see WPF Globalization and Localization Overview.

构造函数

ParserContext()

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

ParserContext(XmlParserContext)

使用指定的 ParserContext 初始化 XmlParserContext 类的新实例。Initializes a new instance of the ParserContext class by using the specified XmlParserContext.

属性

BaseUri

获取或设置此上下文的基 URI。Gets or sets the base URI for this context.

XamlTypeMapper

获取或设置要与此 XamlTypeMapper 一起使用的 ParserContextGets or sets the XamlTypeMapper to use with this ParserContext.

XmlLang

获取或设置此上下文的 xml:lang 字符串。Gets or sets the xml:lang string for this context.

XmlnsDictionary

获取此 XAML 分析器上下文的 XAML 命名空间字典。Gets the XAML namespace dictionary for this XAML parser context.

XmlSpace

获取或设置 xml:space 或此上下文的字符。Gets or sets the character for xml:space or this context.

方法

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)
ToString()

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

(继承自 Object)
ToXmlParserContext(ParserContext)

ParserContext 转换为 XmlParserContextConverts an ParserContext to an XmlParserContext.

操作员

Implicit(ParserContext to XmlParserContext)

将 XAML ParserContext 转换为 XmlParserContextConverts a XAML ParserContext to an XmlParserContext.

适用于

另请参阅