我在为wp7项目添加资源时遇到问题。 我添加了
<resources:LocalizedStrings x:Key="LocalizedStrings"/>
在运行应用程序后,我收到了这样的XamlParseException:未知的解析器错误:Scanner 2147500037。
这是代码。
<Application
x:Class="MyProject.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:vm="clr-namespace:MyProject.ViewModels;assembly=MyProject.ViewModels"
xmlns:resources="clr-namespace:MyProject.Resources;assembly=MyProject.Resources">
<Application.Resources>
<ResourceDictionary>
<resources:LocalizedStrings x:Key="LocalizedStrings"/>
<vm:ViewModelLocator x:Key="Locator"/>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="styles/globalstyles.xaml"/>
<ResourceDictionary Source="styles/UserStyles.xaml"/>
<ResourceDictionary Source="styles/DialogStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
<Application.ApplicationLifetimeObjects>
<shell:PhoneApplicationService
Launching="Application_Launching" Closing="Application_Closing"
Activated="Application_Activated" Deactivated="Application_Deactivated"/>
</Application.ApplicationLifetimeObjects></Application>
答案 0 :(得分:4)
通过创建项目MyProject.LocalizedResources而不是MyProject.Resources来解决此问题
的xmlns:资源= “CLR-名称空间:MyProject.LocalizedResources;装配= MyProject.LocalizedResources”
现在效果很好。
单个词项目名称中的资源导致错误! :(