Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8614457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:07:32+00:00 2026-06-12T05:07:32+00:00

I am just learning WPF and Caliburn.Micro. I am following the code that presented

  • 0

I am just learning WPF and Caliburn.Micro. I am following the code that presented here:
http://caliburnmicro.codeplex.com/wikipage?title=Customizing%20The%20Bootstrapper&referringTitle=Documentation

Apparently this code is for Silverlight but my project is a WPF and for this reason I am getting error that CompositionHost is not defined.

The document stated that I need to initialize the container directly in wpf, but there is no document to show how. How can I initialize the container directly?

Edit 1
The boot strapper is like this in documentation:

     container = CompositionHost.Initialize(
        new AggregateCatalog(
            AssemblySource.Instance.Select(x => new AssemblyCatalog(x)).OfType<ComposablePartCatalog>()
            )
        );

    var batch = new CompositionBatch();

    batch.AddExportedValue<IWindowManager>(new WindowManager());
    batch.AddExportedValue<IEventAggregator>(new EventAggregator());
    batch.AddExportedValue(container);

    container.Compose(batch);

and I converted it to :

    var catalog =
            new AggregateCatalog(
                AssemblySource.Instance.Select(x => new AssemblyCatalog(x)).OfType<ComposablePartCatalog>());

        this.container = new CompositionContainer(catalog);
        var batch = new CompositionBatch();

        batch.AddExportedValue<IWindowManager>(new WindowManager());
        batch.AddExportedValue<IEventAggregator>(new EventAggregator());
        batch.AddExportedValue(this.container);

        this.container.Compose(batch);

But when I run application, I am getting error that MEF can not find implementation for IShell

     Could not locate any instances of contract IShell.

I belive my initialization of MEF is not correct. Can you please help me fix it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:07:33+00:00Added an answer on June 12, 2026 at 5:07 am

    In WPF you need to use an explicit CompositionContainer constructor. In my WPF and Silverlight shared bootstrapper I have used the following #if–#else directive:

    #if SILVERLIGHT
        container = CompositionHost.Initialize(catalog);
    #else
        container = new CompositionContainer(catalog); ;
    #endif
    

    EDIT

    The bootstrapper will identify a component that implements the IShell interface (provided your bootstrapper is extending the Bootstrapper<IShell> base class), so you need to implement a class decorated with MEF export of IShell.

    Typically this would be your ShellViewModel and the declaration would look like this:

    [Export(typeof(IShell))]
    public class ShellViewModel : PropertyChangedBase, IShell
    {
       ...
    }
    

    You can read much more about bootstrapper setup and customization here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just start learning WPF, is that possible I can create an IE toolbar
I've just started learning WPF and like the power of databinding it presents; that
I'm learning WPF and started with this MSDN tutorial. I was just following the
I am very new to WPF. And just started learning threading. Here is my
Just learning C++, encountered an issue that i'm not really sure why the following
I'm just learning WPF. I'm using VS 2008. I've added an Image control to
I've recently been learning the MVVM pattern in WPF and just started making my
Just learning C#, radiobuttons and checkboxes. No urgency. The code works to display the
Just learning WPF databinding and have a gap in my understanding. I've seen a
I am new to WPF and just started learning WPF. I am looking for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.