In the paragraph "Displaying Chinese, Japanese, and Korean Text", a syntax is shown for retrieving the language code from the resource file corresponding to the current thread's culture.
When I try to do this, I get a binding expression error, like this:
System.Windows.Data Error: 'MS.Internal.Data.DynamicValueConverter' converter failed to convert value 'en-US' (type 'System.String'); BindingExpression: Path='PIMSGeneral.Language' DataItem='SilverlightApplication4.LocalizedStrings' (HashCode=49972132); target element is 'SilverlightApplication4.MainPage' (Name=''); target property is 'Language' (type 'System.Windows.Markup.XmlLanguage').. System.Windows.Markup.XamlParseException: [Line: 0 Position: 0]
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.ConvertStringToTypedCValue(IntPtr pContext, UInt32 cClrTypeName, String clrTypeName, UInt32 cValue, String value, CValue&;; outVal, Int32&;; typeIndex)
at MS.Internal.SilverlightTypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at System.ComponentModel.TypeConverter.ConvertFrom(Object value)
at MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, CultureInfo culture, Boolean isForward)
at MS.Internal.Data.DefaultValueConverter.ConvertFrom(Object o, Type destinationType, CultureInfo culture)
at MS.Internal.Data.TargetDefaultValueConverter.Convert(Object o, Type type, Object parameter, CultureInfo culture)
at MS.Internal.Data.DynamicValueConverter.Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
at System.Windows.Data.BindingExpression.ConvertToTarget(Object value).
The xaml:
<
UserControlLanguage="{Binding Path=PIMSGeneral.Language, Source={StaticResource LocalizedStrings}}"
The text value "en-US" comes from the "Language" resource key in the "PIMSGeneral" resource file.
Regardless of this error, I can successfully show Chinese characters through the "LocalizedStrings" static resource, when the current thread's culture is Chinese (zh-CN).
What am I missing?