I see some invalid behavior from XAML docs when changing CurrentCulture. When I have 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 MessageBox.Show (NumberValue.ToString ("c")); When the form starts, I see different results.
If I run the form with the default language, everything will be obvious. However, if I change the culture in the code or at startup, date and number bindings still show formatting in the USA. The displayed value of MessageBox.Show () appropriately reflects the current culture.
Question: Does WPF support CurrentCulture bindings? And if so, what exactly determines the culture that is used for bindings. In my case, this is explicitly en-US, but no matter what I set in my project as the default language, it always binds to en-US.
Any ideas appreciated ...
wpf localization
Rick Strahl Jun 13 '09 at 21:15 2009-06-13 21:15
source share