提前致谢。
我正在尝试从XAML文件加载模块但无法通过,我的xaml文件如下:
<?xml version="1.0" encoding="utf-8" ?>
<Modularity:ModuleCatalog
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"
xmlns:Modularity="clr-namespace:Microsoft.Practices.Composite.Modularity;assembly=Microsoft.Practices.Composite">
<Modularity:ModuleInfo
Ref="ModuleAproject.xap"
ModuleName="ModuleA"
ModuleType="ModuleAproject.ModuleA,ModuleAproject,Version=1.0.0.0">
</Modularity:ModuleInfo>
<Modularity:ModuleInfo
Ref="ModuleBProject.xap"
ModuleName="ModuleB"
ModuleType="ModuleBProject.ModuleB,ModuleBproject,Version=1.0.0.0">
<Modularity:ModuleInfo.DependsOn>
<sys:String>ModuleA</sys:String>
</Modularity:ModuleInfo.DependsOn>
</Modularity:ModuleInfo>
<Modularity:ModuleInfo
Ref="MyDemoApplication.xap"
ModuleName="MainModule"
ModuleType="MyDemoApplication.MainModule,MyDemoApplication,Version=1.0.0.0">
<Modularity:ModuleInfo.DependsOn>
<sys:String>ModuleB</sys:String>
</Modularity:ModuleInfo.DependsOn>
</Modularity:ModuleInfo>
</Modularity:ModuleCatalog>
它抛出的例外是:
System.Windows.Markup.XamlParseException was caught
Message=Cannot add content to an object of type 'Microsoft.Practices.Composite.Modularity.ModuleInfo'. [Line: 12 Position: 27]
LineNumber=12
LinePosition=27
StackTrace:
at MS.Internal.XcpImports.CreateFromXaml(String xamlString, Boolean createNamescope, Boolean requireDefaultNamespace, Boolean allowEventHandlers, Boolean expandTemplatesDuringParse)
at MS.Internal.XcpImports.CreateFromXaml(String xamlString, Boolean createNamescope, Boolean requireDefaultNamespace, Boolean allowEventHandlers)
at System.Windows.Markup.XamlReader.Load(String xaml)
at Microsoft.Practices.Composite.Modularity.ModuleCatalog.CreateFromXaml(Stream xamlStream)
at Microsoft.Practices.Composite.Modularity.ModuleCatalog.CreateFromXaml(Uri builderResourceUri)
at MyDemoApplication.MyBootStrapper.GetModuleCatalog()
at Microsoft.Practices.Composite.UnityExtensions.UnityBootstrapper.ConfigureContainer()
at Microsoft.Practices.Composite.UnityExtensions.UnityBootstrapper.Run(Boolean runWithDefaultConfiguration)
at Microsoft.Practices.Composite.UnityExtensions.UnityBootstrapper.Run()
at MyDemoApplication.App.Application_Startup(Object sender, StartupEventArgs e)
对此非常感谢。 我正在使用Prism 2.2和Silverlight 4.0进行开发
答案 0 :(得分:0)
我很久没有使用过Silverlight,但只是快速查看你的代码,我认为你有以下错误
assembly=Microsoft.Practices.Composite
我相信在我的Silverlight项目中我使用了以下
assembly=Microsoft.Practices.Prism
用于模块化命名空间。 如果这不正确,请告诉我,我很乐意进一步帮助。