私のプログラムのメインメニューは、MenuItems
で構成されたContextMenu
を使用しています。私のプログラム(リソースディクショナリを使用して)のローカライズ中に、のそれぞれのHeader
としてDynamicResource
を設定しました。不思議なことにDynamicResource
はコンパイルされますが、ローカライズ中の変更には影響していないようです(Headers
の言語は変更されません)。 MenuItem
のなぜMenuItemsはDynamicResourceと連携しませんか?
例:
//I'm not sure if the x:Name or the PlacementRectangle is interfering with anything...
<ContextMenu x:Name="MainContextMenu" PlacementRectangle="{Binding RelativeSource={RelativeSource Self}}">
<MenuItem Header="{DynamicResource open}" />
</ContextMenu>
MenuItem
制御の制約は何ですか?それはDynamicResource
で動作するはずですか?私の全体的な目標は、これらをローカライズすることですstrings
、どうすればいいですか?
このプログラムはWPF形式です。ありがとうございました。
UPDATE:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Lang.en-US.xaml" />
</ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<Application.Resources>
UPDATE 2: 私の英語リソース辞書の例の文字列:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<sys:String x:Key="open">Open</sys:String>
</ResourceDictionary>
これは私のリソースディクショナリが私のApp.xamlファイルで参照されている方法です
更新3: 例f私はスペインに現在のリソースディクショナリを変更する方法については慰め:
private void spanishChange_Click(object sender, RoutedEventArgs e)
{
Application.Current.Resources.MergedDictionaries.Clear();
Application.Current.Resources.MergedDictionaries.Add(
(ResourceDictionary)Application.LoadComponent(new Uri("LangspES.xaml", UriKind.Relative)));
LanguageChange.FireLanguageChanged();
}
では、Microsoftの推奨を見たことがありますか?見ますかhttp://msdn.microsoft.com/en-us/library/ms788718(v=vs.110).aspx –
はい、これを見ました。これが唯一の解決策であれば、メニューに別の方法を使用する必要があるかもしれません。 –
このMenuItemをどのように作成していますか?それは動作するはずです。 –