Error or function in TextBlock in Silverlight 4?

I had fun with TextBlock bindings in Silverlight 4.
I have the following situation:

<TextBlock Text="{Binding Date, StringFormat=g}" />
<TextBlock>
    <Run Text="{Binding Date, StringFormat=g}"/>
<TextBlock>

Where Dateis the type property System.DateTime.
I have not changed the current application culture.

My car's culture is Bulgaria (bg-BG). For instance:

TextBlock 1: 11/16/2011 12:49 PM
TextBlock 2: 11/16/2011 12:49 p.m.

Interestingly, the former TextBlockformats the date and time using the en-Us culture (or invariant by default), while the latter uses the bg-BG culture. The thing gets even weirder as the MSDN documentation for the Silverlight TextBlock control states:

InlineCollection XAML TextBlock , Text, InlineCollection , .. p >

- ​​Silverlight 4?

+5
1

, , Language , . , , .

, "StringFormat CurrentCulture Silverlight".

, :

this.Language = XmlLanguage.GetLanguage(Thread.CurrentThread.CurrentCulture.Name);

, <Run>

+2

All Articles