Skip to main content
.NET Framework Class Library
XmlLanguage Class

Represents a language tag for use in XAML markup.

Inheritance Hierarchy
SystemObject
  System.Windows.MarkupXmlLanguage

Namespace:   System.Windows.Markup
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml
Syntax
<[%$TOPIC/ms613449_en-us_VS_110_2_0_0_0_0%](GetType([%$TOPIC/ms613449_en-us_VS_110_2_0_0_0_1%]))> _
Public Class XmlLanguage
[[%$TOPIC/ms613449_en-us_VS_110_2_0_1_0_0%](typeof([%$TOPIC/ms613449_en-us_VS_110_2_0_1_0_1%]))]
public class XmlLanguage
[[%$TOPIC/ms613449_en-us_VS_110_2_0_2_0_0%](typeof([%$TOPIC/ms613449_en-us_VS_110_2_0_2_0_1%]))]
public ref class XmlLanguage
[<[%$TOPIC/ms613449_en-us_VS_110_2_0_3_0_0%](typeof([%$TOPIC/ms613449_en-us_VS_110_2_0_3_0_1%]))>]
type XmlLanguage =  class end
<object property="prefix"/>
- or -
<object property="prefix-subcode"/>

XAML Values

prefix

Language prefix, using the ISO 639-1 language prefix values. For example "en", or "zh". Uppercase values are accepted and converted to lowercase. This may also be an empty attribute, "".

subcode

If provided, must be preceded by a single hyphen. Then, a subcode as defined by RFC 3066. The most typical usage, and the one which is most likely to properly map to a CultureInfo, is a country or regional designation such as "-us" or "-hk". Uppercase values are accepted and converted to lowercase.

The XmlLanguage type exposes the following members.

Properties
  NameDescription
Public property Static member EmptyGets a static XmlLanguage instance as would be created by GetLanguage with the language tag as an empty attribute string.
Public property IetfLanguageTagGets the string representation of the language tag.
Top
Methods
  NameDescription
Public method Equals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetEquivalentCultureReturns the appropriate equivalent CultureInfo for this XmlLanguage, if and only if such a CultureInfo is registered for the IetfLanguageTag value of this XmlLanguage
Public method GetHashCodeServes as the default hash function. (Inherited from Object.)
Public method Static member GetLanguageReturns a XmlLanguage instance, based on a string representing the language per RFC 3066.
Public method GetSpecificCultureReturns the most-closely-related non-neutral CultureInfo for this XmlLanguage.
Public method GetTypeGets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public method ToStringReturns a String that represents the current XmlLanguage. (Overrides ObjectToString.)
Top
Remarks

The language tag may or may not have a registered CultureInfo present on the system where the XAML is interpreted.

This class is useful for dealing with values represented using xml:lang in XML.

Language tags can be specified in two-character form or in a hyphenated language-locale form. See RFC 3066.

Note that the XML specification allows the empty string for xml:lang, although that is not permitted by RFC 3066; therefore, the XmlLanguage type permits "" (empty attribute string). A default-constructed XmlLanguage behaves as if constructed with "" (empty string).

Version Information

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.