Caliburn.Micro没有"Bootstrapper"在App.xaml中的名称空间中 [英] Caliburn.Micro does not have "Bootstrapper" in a namespace in App.xaml

查看:70
本文介绍了Caliburn.Micro没有"Bootstrapper"在App.xaml中的名称空间中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看来我终于使它起作用了.我问了我之前提到的那个帖子的作者,他说这是一个已知问题.他还给了mi一个解决方法(在帖子下方的评论中),因此我认为此问题已结束.但是,感谢大家为我的问题所花费的时间:)

It seems that I finally made it to work. I asked an author of that post which I referred before and he said that it's a known issue. He also gave mi a workaround (in the comment below the post), so I consider this question as closed. But thanks to all of you for time spent with my problems :)

我正在尝试使用Caliburn Micro框架学习MVVM,但是从一开始我就遇到了问题.我正在追踪这个教程,我在App.xaml中得到了这样的代码:

I'm trying to learn MVVM with Caliburn Micro framework, but I got problems from the beginning. I'm following this tutorial and I got such a code in App.xaml:

<Application
x:Class="Caliburn.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:caliburnMicro="clr-namespace:Caliburn">
<!--Application Resources-->
    <Application.Resources>
        <caliburnMicro:Bootstrapper x:Key="bootstrapper" />
    </Application.Resources>
</Application>

但是我得到一个错误:

名称空间"clr-namespace:Caliburn"中不存在名称"Bootstrapper".

The name "Bootstrapper" does not exist in the namespace "clr-namespace:Caliburn".

我从NuGet存储库中获得了Caliburn Micro 1.5.2.任何想法表示赞赏...

I got Caliburn Micro 1.5.2 from NuGet repository. Any ideas appreciated...

我的引导程序:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Caliburn.Micro;

namespace Caliburn
{
public class Bootstrapper : PhoneBootstrapper
{
    PhoneContainer container;

    protected override void Configure()
    {
        container = new PhoneContainer();

        container.RegisterPhoneServices(RootFrame);
        //container.PerRequest<MainPageViewModel>();

        AddCustomConventions();
    }

    static void AddCustomConventions()
    {
        //ellided  
    }

    protected override object GetInstance(Type service, string key)
    {
        return container.GetInstance(service, key);
    }

    protected override IEnumerable<object> GetAllInstances(Type service)
    {
        return container.GetAllInstances(service);
    }

    protected override void BuildUp(object instance)
    {
        container.BuildUp(instance);
    }
}
}

推荐答案

您应该定义自己的Bootstrapper类型,该类型派生自Caliburn.Micro bootstrapper类型之一.然后,应用程序资源中的资源应该是此引导程序的实例.

You should define your own Bootstrapper type which derives from one of the Caliburn.Micro bootstrapper types. The resource in your application resources should then be an instance of this bootstrapper.

学习过程中最简单的选择是使用 Caliburn.Micro.Start NuGet软件包,并了解其引导程序实现.另外,文档描述您应在App.xaml文件中使用的标记.

The easiest option whilst learning is to use the Caliburn.Micro.Start NuGet package, and have a look at its bootstrapper implementation. The documentation also describes the markup you should use in your App.xaml file.

这篇关于Caliburn.Micro没有"Bootstrapper"在App.xaml中的名称空间中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆