我有一个使用 Prism 4.0 编写的应用程序。它有很多视图,它们具有绑定到 ViewModel 属性的不同控件(我的应用程序中没有模型)。其中一些控件可视化日期时间和十进制值。在某些地方,字符串表示具有正确的格式,但在某些地方却没有。但是,如果我将这些十进制和日期时间属性表示为字符串属性并在基础值上调用 ToString() 方法,那么它们的格式将是正确的。所以我的 ViewModel 线程的 CurrentThread.CurrentCulture 是正确的。但是数据绑定器或棱镜或任何将日期时间和十进制值转换为字符串线程文化的代码似乎不正确,或者他们可能根本没有使用当前文化。我的调试技能还不足以躲在窗帘后面,
[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)
任何想法如何强制 WPF 和 Prism 在任何地方使用正确的数字和日期时间格式?