これは私の問題です: 2 つの異なるファイルにリソースを持つ多言語 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 Designer にそのリソースが表示されません。
一方、App.xaml ファイルで ResourceDictionary を次のように定義すると、次のようになります。
<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>
次に、デザイナーにこのリソースがありますが、多言語を設定できません。
多言語アプリケーションを使用してデザイナーでリソースを表示する可能性はありますか? アプリケーションの電源が入っている間に app.xaml ファイルを変更したのでしょうか。