我解決這樣說:
創建一個類,如:
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}"
/>
我目前面臨同樣的問題。有沒有其他的方法可以與Blend兼容? –
在下面添加了答案 – swinefeaster