我很难获得多个视图来对抗1个viewmodel.我已经阅读了多视图支持的命名约定而没有从中获得太多的东西,并且在此过程中尝试了无数的东西.
举个简单的例子吧.假设我有一个驻留在ShellViewModel中的ViewModel,它基本上包含Person对象列表.我想在我的应用程序中以两种不同的方式显示它们.

在这种情况下命名视图的正确方法是什么,以及如何在ShellView中显示两个视图?
我在我的应用程序中使用MEF来加载一些简单的插件.每个插件都包含一个ViewModel和一个相应的View.
我能够成功创建这样一个插件的ViewModel实例,但Caliburn.Micro说它无法找到它的视图.插件中的ViewModel称为SimpleValueDisplayViewModel,视图为SimpleValueDisplayView,具有相同的名称空间.
我的Bootstrapper中的相关代码:
public class MefBootstrapper : Bootstrapper<ShellViewModel>
{
protected override void Configure()
{
string pluginPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins");
if (!Directory.Exists(pluginPath))
Directory.CreateDirectory(pluginPath);
var catalog = new AggregateCatalog(
AssemblySource.Instance.Select(x => new AssemblyCatalog(x)).OfType<ComposablePartCatalog>()
.Concat(new ComposablePartCatalog[] { new DirectoryCatalog("Plugins")})
);
_container = new CompositionContainer(catalog);
var batch = new CompositionBatch();
batch.AddExportedValue<IWindowManager>(new WindowManager());
batch.AddExportedValue<IEventAggregator>(new EventAggregator());
batch.AddExportedValue(_container);
_container.Compose(batch);
}
}
Run Code Online (Sandbox Code Playgroud)
我是否需要通知Caliburn.Micro关于MEF在"插件"目录中找到的程序集?
编辑:我尝试重写SelectAssemblies并将"插件"目录中的所有程序集添加到AssemblySource.Instance.然而,然后我得到MEF找到程序集两次的问题,这反过来在我实例化ViewModel时产生问题.