1
我無法找到任何意見Caliburn.Micro。引導程序啓動,但是然後出現一個通用窗口,即使存在ShellView.xaml,也不存在任何視圖ShellViewModel。做什麼?找不到視圖模型
引導程序
public sealed class AppBootstrapper : BootstrapperBase
{
private IKernel _kernel;
#region Bootstrapper
public AppBootstrapper()
{
Start();
}
protected override void Configure()
{
_kernel = new StandardKernel();
_kernel.Bind<IWindowManager>().To<WindowManager>().InSingletonScope();
_kernel.Bind<IEventAggregator>().To<EventAggregator>().InSingletonScope();
_kernel.Bind<IShell>().To<ShellViewModel>();
}
protected override void OnStartup(object sender, System.Windows.StartupEventArgs e)
{
DisplayRootViewFor(typeof (IShell));
}
protected override void OnExit(object sender, EventArgs e)
{
_kernel.Dispose();
base.OnExit(sender, e);
}
protected override object GetInstance(Type serviceType, string key)
{
if (serviceType != null) {
return _kernel.Get(serviceType);
}
throw new ArgumentNullException("serviceType");
}
protected override IEnumerable<object> GetAllInstances(Type serviceType)
{
return _kernel.GetAll(serviceType);
}
protected override void BuildUp(object instance)
{
_kernel.Inject(instance);
}
#endregion
}
}
ShellViewModel
public sealed class ShellViewModel : Screen, IShell
{
public ShellViewModel()
{
DisplayName = "Hello";
}
}
日誌打開了嗎? –
@DerekBeattie在Caliburn?我如何實現這一目標? – Acrotygma
你有沒有StartupUri意外設置在App.xaml的應用程序元素中? – devdigital