这就是我的问题:我有多语言的WPF应用程序,它的资源位于两个不同的文件中。现在,我在app.xaml.cs中选择合适的一个,如下所示:
var dict = new ResourceDictionary();
switch (Thread.CurrentThread.CurrentCulture.ToString())
{
case "de-DE":
dict.Source = new Uri("pack://application:,,,/Resources;component/StringResources.de-DE.xaml", UriKind.Absolute);
break;
default:
dict.Source = new Uri("pack://application:,,,/Resources;component/StringResources.xaml", UriKind.Absolute);
break;
}
Resources.MergedDictionaries.Add(dict);
而且一切都很好,但我在VisualStudio设计器中看不到这些资源。
另一方面,当我像这样在ResourceDictionary文件中定义App.xaml时:
<Application x:Class="Ampe.UI.Views.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Exit="App_OnExit" ShutdownMode="OnMainWindowClose">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Resources;component/StringResources.de-DE.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
那么我在designer中有这个资源,但是我不能设置多语言。
在具有多语言应用程序的设计器中,是否存在可视资源的可能性?可能是在打开应用程序时更改了app.xaml文件吗?
发布于 2015-07-23 10:39:37
你走的路是对的。
对我来说很管用。希望能帮上忙。
https://stackoverflow.com/questions/31584120
复制相似问题