I have been having some 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 Date is a property of type System.DateTime.
I haven't changed the current culture of the application.
The culture of my machine is Bulgaria (bg-BG). For example:
TextBlock 1: 11/16/2011 12:49 PM
TextBlock 2: 16.11.2011 г. 12:49 ч.
The interesting thing is that the first TextBlock formats the date and time using en-Us culture (or the default invariant one) while the second one uses bg-BG culture.
Thing get even stranger since MSDN documentation for Silverlight TextBlock control says:
If the InlineCollection is created from XAML as inner text of a TextBlock object element, or if it is created by setting the Text property, the InlineCollection contains a single Run that contains that text.
Am I missing something here or it can be considered bug in Silverlight 4?