【发布时间】:2020-12-10 03:06:45
【问题描述】:
我已经开始在 WPF 中为 MVVM 使用Stylet。我在命名空间StyletProj.Pages 中有我的视图
在命名空间StyletProj 中使用Bootstrapper,在命名空间StyletViewModels.ViewModels 中使用我的ViewModels(在另一个程序集中)。我需要链接视图和视图模型。我怎样才能做到这一点?到目前为止,这就是我的引导程序中的内容。
namespace StyletProj
{
public class Bootstrapper : Bootstrapper<ShellViewModel>
{
protected override void ConfigureIoC(IStyletIoCBuilder builder)
{
// Configure the IoC container in here
}
protected override void Configure()
{
// Perform any other configuration before the application starts
var viewManage = this.Container.Get<ViewManager>();
viewManage.NamespaceTransformations
}
}
}
我该如何处理NamespaceTransformations?这是错误的方式吗?我还发现了这个example(和wiki page),但他们建议创建一个全新的ViewManager 来执行此操作,这似乎有点矫枉过正。我该如何以最简单的方式解决这个问题(我宁愿不创建新的ViewManager?我什至不明白他们在示例中做了什么。
【问题讨论】: