XmlnsDictionary Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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 ICollection
interface IEnumerable
interface IDictionary
interface IXamlNamespaceResolver
Public Class XmlnsDictionary
Implements IDictionary, IXamlNamespaceResolver
- Inheritance
-
XmlnsDictionary
- Implements
Remarks
XmlnsDictionary maps XAML namespace prefixes to the complete XAML namespace URI. For XAML usage in applications and XAML namespaces in general, the URI is often not a schema-style URI that includes http://. It is instead a user-defined mapping to a CLR namespace and assembly. That assembly contains the backing types being referred to. For details, see XAML Namespaces and Namespace Mapping for WPF XAML.
The XmlnsDictionary adds the concept of scope for a XAML namespace. A default IDictionary might contain prefix keys and XML namespace URI values. The scope concept in XmlnsDictionary parallels the XML concept that a prefix might be redefined. 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). 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. However, XmlnsDictionary does expose PushScope and PopScope so that a custom ParserContext implementation that changes scope can synchronize with the scope for the XmlnsDictionary.
Constructors
| Name | Description |
|---|---|
| XmlnsDictionary() |
Initializes a new instance of the XmlnsDictionary class. |
| XmlnsDictionary(XmlnsDictionary) |
Initializes a new instance of the XmlnsDictionary class by using the specified dictionary as a copy source. |
Properties
| Name | Description |
|---|---|
| Count |
Gets the number of items in the XmlnsDictionary. |
| IsFixedSize |
Gets a value that indicates whether the size of the XmlnsDictionary is fixed. |
| IsReadOnly |
Gets a value that indicates whether the XmlnsDictionary is read-only. |
| IsSynchronized |
Gets a value that indicates whether access to this XmlnsDictionary is thread safe. |
| Item[Object] |
Gets or sets the XAML namespace URI associated with the specified prefix. |
| Item[String] |
Gets or sets the XAML namespace URI associated with the specified prefix. |
| Keys |
Gets a collection of all the keys in the XmlnsDictionary. |
| Sealed |
Gets a value that indicates whether the XmlnsDictionary is sealed. |
| SyncRoot |
Gets an object that can be used to synchronize access to the XmlnsDictionary. |
| Values |
Gets a collection of all the values in the XmlnsDictionary. |
Methods
| Name | Description |
|---|---|
| Add(Object, Object) |
Adds a prefix-URI pair to this XmlnsDictionary. |
| Add(String, String) |
Adds a prefix-URI pair to this XmlnsDictionary. |
| Clear() |
Removes all entries from this XmlnsDictionary. |
| Contains(Object) |
Returns a value that indicates whether the specified prefix key is in this XmlnsDictionary. |
| CopyTo(Array, Int32) |
Copies the entries in the XmlnsDictionary to the specified array. |
| CopyTo(DictionaryEntry[], Int32) |
Copies the entries in the XmlnsDictionary to the specified DictionaryEntry array. |
| DefaultNamespace() |
Looks up the XAML namespace that corresponds to the default XAML namespace. |
| GetDictionaryEnumerator() |
Returns a dictionary enumerator that iterates through this XmlnsDictionary. |
| GetEnumerator() |
Returns an enumerator that iterates through this XmlnsDictionary. |
| GetNamespace(String) |
Retrieves a XAML namespace for the provided prefix string. |
| GetNamespacePrefixes() |
Returns all possible prefix-XAML namespace mappings (NamespaceDeclaration values) that are available in the active schema context. |
| LookupNamespace(String) |
Returns the XAML namespace URI that corresponds to the specified XML namespace prefix. |
| LookupPrefix(String) |
Returns the prefix that corresponds to the specified XAML namespace URI. |
| PopScope() |
Pops the scope of the XmlnsDictionary. |
| PushScope() |
Pushes the scope of the XmlnsDictionary. |
| Remove(Object) |
Removes the item with the specified prefix key from the XmlnsDictionary. |
| Remove(String) |
Removes the item with the specified prefix key from the XmlnsDictionary. |
| Seal() |
Locks the dictionary so that it cannot be changed. |
Explicit Interface Implementations
| Name | Description |
|---|---|
| IDictionary.GetEnumerator() |
For a description of this member, see GetEnumerator(). |
| IEnumerable.GetEnumerator() |
For a description of this member, see GetEnumerator(). |