XmlnsDictionary 类

定义

表示包含 WPF 中 XAML 命名空间的 xmlns 映射的字典。Represents a dictionary that contains xmlns mappings for XAML namespaces in WPF.

public ref class XmlnsDictionary : System::Collections::IDictionary, System::Xaml::IXamlNamespaceResolver
public class XmlnsDictionary : System.Collections.IDictionary, System.Xaml.IXamlNamespaceResolver
type XmlnsDictionary = class
    interface IDictionary
    interface ICollection
    interface IEnumerable
    interface IXamlNamespaceResolver
Public Class XmlnsDictionary
Implements IDictionary, IXamlNamespaceResolver
继承
XmlnsDictionary
实现

注解

XmlnsDictionary将 XAML 命名空间前缀映射到完整的 XAML 命名空间 URI。XmlnsDictionary maps XAML namespace prefixes to the complete XAML namespace URI. 对于应用程序中的 XAML 使用情况和 XAML 命名空间,通常 URI 通常不是包含http://的架构样式 uri。For XAML usage in applications and XAML namespaces in general, the URI is often not a schema-style URI that includes http://. 而是用户定义的到 CLR 命名空间和程序集的映射。It is instead a user-defined mapping to a CLR namespace and assembly. 该程序集包含所引用的后备类型。That assembly contains the backing types being referred to. 有关详细信息,请参阅WPF xaml 的 XAML 命名空间和命名空间映射For details, see XAML Namespaces and Namespace Mapping for WPF XAML.

为 XAML 命名空间添加作用域的概念。XmlnsDictionaryThe XmlnsDictionary adds the concept of scope for a XAML namespace. 默认值IDictionary可能包含前缀键和 XML 命名空间 URI 值。A default IDictionary might contain prefix keys and XML namespace URI values. XmlnsDictionary的作用域概念与 XML 概念相似,后者可能会重新定义前缀。The scope concept in XmlnsDictionary parallels the XML concept that a prefix might be redefined. 如果是这样,则重定义仅适用于 XML 的 DOM 视图中的该级别或更低的位置(上一个定义适用于 DOM 中的更高级别)。If so, the redefinition only applies at that level or below in a DOM view of the XML (the previous definition applies at higher level in the DOM). 作用域概念主要在XmlnsDictionary API 中进行抽象,因此你可以调用 api LookupNamespace ,如,而不考虑作用域。The scope concept is mostly abstracted away in the XmlnsDictionary API, such that you can call APIs such as LookupNamespace without being concerned about scope. 但是, XmlnsDictionary会公开PushScopePopScope这样,更改范围ParserContext的自定义实现可以与的XmlnsDictionary作用域同步。However, XmlnsDictionary does expose PushScope and PopScope so that a custom ParserContext implementation that changes scope can synchronize with the scope for the XmlnsDictionary.

构造函数

XmlnsDictionary()

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

XmlnsDictionary(XmlnsDictionary)

通过使用指定字典作为复制源,初始化 XmlnsDictionary 类的新实例。Initializes a new instance of the XmlnsDictionary class by using the specified dictionary as a copy source.

属性

Count

获取 XmlnsDictionary 中的项数。Gets the number of items in the XmlnsDictionary.

IsFixedSize

获取一个值,该值指示 XmlnsDictionary 的大小是否是固定的。Gets a value that indicates whether the size of the XmlnsDictionary is fixed.

IsReadOnly

获取一个值,该值指示 XmlnsDictionary 是否为只读。Gets a value that indicates whether the XmlnsDictionary is read-only.

IsSynchronized

获取一个值,该值指示对此 XmlnsDictionary 的访问是否是线程安全的。Gets a value that indicates whether access to this XmlnsDictionary is thread safe.

Item[Object]

获取或设置与指定前缀关联的 XAML 命名空间 URI。Gets or sets the XAML namespace URI associated with the specified prefix.

Item[String]

获取或设置与指定前缀关联的 XAML 命名空间 URI。Gets or sets the XAML namespace URI associated with the specified prefix.

Keys

获取 XmlnsDictionary 中的所有键的集合。Gets a collection of all the keys in the XmlnsDictionary.

Sealed

获取一个值,该值指示 XmlnsDictionary 是否是密封的。Gets a value that indicates whether the XmlnsDictionary is sealed.

SyncRoot

获取可用于同步对 XmlnsDictionary 的访问的对象。Gets an object that can be used to synchronize access to the XmlnsDictionary.

Values

获取 XmlnsDictionary 中的所有值的集合。Gets a collection of all the values in the XmlnsDictionary.

方法

Add(Object, Object)

将一个前缀 URI 对添加到此 XmlnsDictionaryAdds a prefix-URI pair to this XmlnsDictionary.

Add(String, String)

将一个前缀 URI 对添加到此 XmlnsDictionaryAdds a prefix-URI pair to this XmlnsDictionary.

Clear()

从此 XmlnsDictionary 中移除所有项。Removes all entries from this XmlnsDictionary.

Contains(Object)

返回一个值,该值指示指定的前缀键是否在此 XmlnsDictionary 中。Returns a value that indicates whether the specified prefix key is in this XmlnsDictionary.

CopyTo(Array, Int32)

XmlnsDictionary 中的项复制到指定的数组中。Copies the entries in the XmlnsDictionary to the specified array.

CopyTo(DictionaryEntry[], Int32)

XmlnsDictionary 中的项复制到指定的 DictionaryEntry 数组中。Copies the entries in the XmlnsDictionary to the specified DictionaryEntry array.

DefaultNamespace()

查找与默认 XAML 命名空间对应的 XAML 命名空间。Looks up the XAML namespace that corresponds to the default XAML namespace.

Equals(Object)

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

(继承自 Object)
GetDictionaryEnumerator()

返回一个循环访问此 XmlnsDictionary 的字典枚举数。Returns a dictionary enumerator that iterates through this XmlnsDictionary.

GetEnumerator()

返回一个循环访问此 XmlnsDictionary 的枚举数。Returns an enumerator that iterates through this XmlnsDictionary.

GetHashCode()

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

(继承自 Object)
GetNamespace(String)

针对提供的前缀字符串检索 XAML 命名空间。Retrieves a XAML namespace for the provided prefix string.

GetNamespacePrefixes()

返回所有可能的前缀到 XAML 命名空间映射(NamespaceDeclaration 值),这些映射可在活动架构上下文中找到。Returns all possible prefix-XAML namespace mappings (NamespaceDeclaration values) that are available in the active schema context.

GetType()

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

(继承自 Object)
LookupNamespace(String)

返回与指定 XAML 命名空间前缀对应的 XML 命名空间 URI。Returns the XAML namespace URI that corresponds to the specified XML namespace prefix.

LookupPrefix(String)

返回与指定 XAML 命名空间 URI 对应的前缀。Returns the prefix that corresponds to the specified XAML namespace URI.

MemberwiseClone()

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

(继承自 Object)
PopScope()

弹出 XmlnsDictionary 的范围。Pops the scope of the XmlnsDictionary.

PushScope()

推入 XmlnsDictionary 的范围。Pushes the scope of the XmlnsDictionary.

Remove(Object)

XmlnsDictionary 中移除具有指定前缀键的项。Removes the item with the specified prefix key from the XmlnsDictionary.

Remove(String)

XmlnsDictionary 中移除具有指定前缀键的项。Removes the item with the specified prefix key from the XmlnsDictionary.

Seal()

锁定字典,使其无法进行更改。Locks the dictionary so that it cannot be changed.

ToString()

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

(继承自 Object)

显式界面实现

IDictionary.GetEnumerator()

有关此成员的说明,请参见 GetEnumerator()For a description of this member, see GetEnumerator().

IEnumerable.GetEnumerator()

有关此成员的说明,请参见 GetEnumerator()For a description of this member, see GetEnumerator().

扩展方法

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于

另请参阅