I have an application written using Prism 4.0. It has lots of Views which have different controls which bind to ViewModel properties (I don't have Models in my app). Some of those controls visualize datetime and decimal values. In some places the string representations have correct format, but in some places they don't. But if I represent those decimal and datetime properties as string properties and call ToString() methods on the underlying values, then their format will be correct. So CurrentThread.CurrentCulture of my ViewModel thread is correct. But the data binder's or Prism's or whatever code converts datetime and decimal values to strings thread culture seems to be incorrect, or maybe they are not using current culture at all. My debugging skills are not sufficient yet to go behind the curtains, but I think that magic happens here (stack trace):
[Native to Managed Transition]
PresentationFramework.dll!MS.Internal.Data.PropertyPathWorker.GetValue(object item, int level)
PresentationFramework.dll!MS.Internal.Data.PropertyPathWorker.RawValue(int k)
PresentationFramework.dll!MS.Internal.Data.PropertyPathWorker.RawValue()
PresentationFramework.dll!MS.Internal.Data.ClrBindingWorker.RawValue()
PresentationFramework.dll!System.Windows.Data.BindingExpression.TransferValue(object newValue, bool isASubPropertyChange)
PresentationFramework.dll!System.Windows.Data.BindingExpression.ScheduleTransfer(bool isASubPropertyChange)
PresentationFramework.dll!MS.Internal.Data.ClrBindingWorker.NewValueAvailable(bool dependencySourcesChanged, bool initialValue, bool isASubPropertyChange)
PresentationFramework.dll!MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(int k, System.ComponentModel.ICollectionView collectionView, object newValue, bool isASubPropertyChange)
PresentationFramework.dll!MS.Internal.Data.ClrBindingWorker.OnSourcePropertyChanged(object o, string propName)
Any ideas how to force WPF & Prism to use correct number and datetime format anywhere?
Placing the following line of code in your startup code may fix the issue:
This will set the LanguageProperty for all WPF controls to the current culture.