共用方式為


TextElement.Language Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the language of the content within an TextElement element.

Namespace:  System.Windows.Documents
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Property Language As XmlLanguage
public XmlLanguage Language { get; set; }
<textElement Language="xmlLanguageStr" ... />

XAML Values

xmlLanguageStr

"prefix"
- or -

"prefix-subcode"

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 equivalent to lowercase.

To specify a Language value in XAML, you specify a string that represents the same string you would use in a call to GetLanguage.

Property Value

Type: System.Windows.Markup.XmlLanguage
A value of type XmlLanguage. The default is a XmlLanguage value created with the string en-US (IetfLanguageTag is "en-US").

Remarks

Dependency property identifier field: LanguageProperty

Language is generally equivalent to the XML-defined attribute xml:lang. See Remarks for FrameworkElement.Language.

Version Information

Silverlight

Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.