English 中文(简体)
WPF XAML StringFormat: Culture Workaroundbreak in C# 4.0?
原标题:WPF XAML StringFormat: Culture Workaround broken in C# 4.0?

围绕......开展的工作

FrameworkElement.LanguageProperty.OverrideMetadata(
 typeof(FrameworkElement), 
 new FrameworkPropertyMetadata(
  XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

至今仍在工作(见https://stackoverflow.com/questions/520115/stringfomat- localization-problem/520334#520334>)。 wpf中的本地化问题。

直到我才把我的申请从3.5SP1输入到4.0,它一直在工作。 但现在到4时,它又停止了工作。 任何人都经历过这种情况?

http://www.un.org。 现在甚至没有在3.5SP1中工作。 我认为,这与安装4 000套设备有关,因为以前这项工作正在进行。

它不是通过增加工作或取消工作。 我甚至试图增加......

CultureInfo.CurrentCulture.ClearCachedData();
this.Language = XmlLanguage.GetLanguage( CultureInfo.CurrentCulture.IetfLanguageTag);

<代码>Window Constructionor。 这也起到了一定的作用。

问题回答

<>1>。 确保尽早达到<代码>LanguageProperty的最高违约值。 采用静态构造者是最合适的。 之所以如此重要,是因为BledExpression这一财产的ches价值,而且此后由于履约原因没有重新评价。

<>2>。 您的<代码>CultureInfo.CurrentCulture? 你们是否确信这符合你们的期望?

<>3>。 如果你具体指明了<条码>xml:<>/条码>在树冠上下一定位置,则“Language 财产元数据无效果”。 E.g. 如果说:

<StackPanel xml:lang="it">
  <TextBlock Text="{Binding StringFormat=C}"/>
</StackPanel>

不管你在财产元数据中设定什么,你都会得到意大利货币。

<>4>。 如果你具体指明有约束力的财产,则对<代码>Language上的财产元数据没有效力。 E.g. 如果你说的话:<TextBlock Text="{Bled StringFormat=C, ConverterCulture=ja}”/>,无论你在财产元数据或xml:lang上设定什么,你都会得到日本货币。

我知道,在框架之间并没有改变这种行为。

希望这一帮助





相关问题
WPF convert 2d mouse click into 3d space

I have several geometry meshes in my Viewport3D, these have bounds of (w:1800, h:500, d:25). When a user clicks in the middle of the mesh, I want the Point3D of (900, 500, 25)... How can I achieve ...

Editing a xaml icons or images

Is it possible to edit a xaml icons or images in the expression design or using other tools? Is it possible to import a xaml images (that e.g you have exported) in the expression designer for editing?...

WPF: writing smoke tests using ViewModels

I am considering to write smoke tests for our WPF application. The question that I am faced is: should we use UI automation( or some other technology that creates a UI script), or is it good enough to ...

WPF - MVVM - NHibernate Validation

Im facing a bit of an issue when trying to validate a decimal property on domain object which is bound to a textbox on the view through the viewmodel. I am using NHibernate to decorate my property on ...

How do WPF Markup Extensions raise compile errors?

Certain markup extensions raise compile errors. For example StaticExtension (x:Static) raises a compile error if the referenced class cannot be found. Anyone know the mechanism for this? Is it baked ...

WPF design-time context menu

I am trying to create a custom wpf control, I m wondering how I can add some design-time features. I ve googled and can t seem to get to my goal. So here s my simple question, how can I add an entry ...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签