我是这样解决的:
创建一个类,例如:
public class Strang
{
public string IDST_LOAD_TITLE
{ get { return Strings.IDST_LOAD_TITLE; } }
public string IDST_SAVE_TITLE
{ get { return Strings.IDST_SAVE_TITLE; } }
...
将其添加到您的 app.xaml:
<Application
x:Class="MyApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:myApp="using:MyApp"
>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!-- Look here! -->
<myApp:Strang x:Key="Strang" />
</ResourceDictionary>
</Application.Resources>
</Application>
然后在您页面的 xaml 代码中,执行以下操作:
<TextBlock
x:Name="m_titleStatic"
Text="{Binding IDST_LOAD_TITLE}"
DataContext="{StaticResource Strang}"
/>