C# 从 XAML 文件创建模块目录
我在 prism 库上下文中从 xaml 文件加载模块时遇到问题。 模块的 xaml 如下所示:
<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.Prism.Modularity;assembly=Microsoft.Practices.Prism">
<Modularity:ModuleInfoGroup InitializationMode="WhenAvailable">
<Modularity:ModuleInfo Ref="file://HelloWorldModule.dll" ModuleName="HelloWorldModule" ModuleType="HelloWorldModule.Views.HelloWorldView, HelloWorldModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</Modularity:ModuleInfoGroup>
到目前为止,解析器找到了这个xaml,但没有找到HelloWorldModule.dll。 我在文档中找不到任何有用的内容,因为这些都是针对 Silverlight 的,但我的项目是 WFP 应用程序。
shell.exe 的相对路径是:
\Projects\QFX_Shell\bin\Debug
HelloWorldModule.dll 的路径是:
\Projects\HelloWorldModule\bin\Debug
那么问题是“Ref”属性期望什么值?它是 HelloWorldModule.dll 的绝对路径吗?
第二个问题是 ModuleType 属性应该具有什么值:
namespace HelloWorldModule.Views
{
/// <summary>
/// Interaction logic for HelloWorldView.xaml
/// </summary>
public partial class HelloWorldView : UserControl
{
public HelloWorldView()
{
InitializeComponent();
}
}
}
类类型名称是否包含命名空间?
ModuleType="HelloWorldModule.Views.HelloWorldView, HelloWorldModule...
下一个问题是,HelloWorldModule.dll 是否与 Shell.exe 位于同一文件夹中? 谢谢, 于尔根
I have a problem with loading modules from a xaml file in the context of the prism library.
The xaml for the modules look like this:
<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.Prism.Modularity;assembly=Microsoft.Practices.Prism">
<Modularity:ModuleInfoGroup InitializationMode="WhenAvailable">
<Modularity:ModuleInfo Ref="file://HelloWorldModule.dll" ModuleName="HelloWorldModule" ModuleType="HelloWorldModule.Views.HelloWorldView, HelloWorldModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</Modularity:ModuleInfoGroup>
So far, the parser finds this xaml but it does not find the HelloWorldModule.dll.
I could not find anything useful in the docs since these are all for Silverlight, but my project is a WFP app.
The relative path to the shell.exe is:
\Projects\QFX_Shell\bin\Debug
and the path to the HelloWorldModule.dll is:
\Projects\HelloWorldModule\bin\Debug
So the question is what value does the "Ref" attribute expect? Is it the absolute path for the HelloWorldModule.dll?
Second question is what value should the ModuleType attribute have:
namespace HelloWorldModule.Views
{
/// <summary>
/// Interaction logic for HelloWorldView.xaml
/// </summary>
public partial class HelloWorldView : UserControl
{
public HelloWorldView()
{
InitializeComponent();
}
}
}
Is the namespace included for the class type name?
ModuleType="HelloWorldModule.Views.HelloWorldView, HelloWorldModule...
Next question is, does the HelloWorldModule.dll to be in the same folder as the Shell.exe?
Thanks,
Juergen
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有关您的问题的更多建议,请参阅《Prism 4.0 - 2010 年 11 月》手册的第 4 章《模块化应用程序开发》。
For more advice about your questions, have a look at chapter 4, Modular Application Development of the Prism 4.0 - November 2010 manual.