I'm seeing some invalid behavior from XAML documents when the CurrentCulture is changed. When I have some elements like this in a Window:
<Window x:Class="WpfLocalizationLocBaml.Test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:glob="clr-namespace:System.Globalization;assembly=mscorlib"
x:Name="wndTest"
Title="Test" Height="300" Width="300">
<StackPanel>
<TextBlock x:Name="lblCultureName"
Text="{Binding Source={x:Static glob:CultureInfo.CurrentCulture},
Path=DisplayName}" />
<TextBlock x:Name="lblLocaleDateValue"
Text="{Binding ElementName=wndTest, Path=TestDate}"/>
<TextBlock x:Name="lblLocaleNumberValue"
Text="{Binding ElementName=wndTest,Path=NumberValue,StringFormat=c}" />
</StackPanel>
</Window>
as well as a MessageBox.Show( NumberValue.ToString("c") ); when the form starts I'm seeing different results.
If I run the form with the default language all is well obviously. However, if I change the culture in code or at startup the bindings to the date and number values still show en-US formatting. The MessageBox.Show() value displayed appropriately reflects the current culture.
Question: Does WPF not respect CurrentCulture in bindings? And if so what exactly determines the culture that is used for the bindings. It's clearly en-US in my case, but regardless what I set in my project as the default language it always binds in en-US.
Any ideas appreciated...