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

  • SEARCH
  • Home
  • 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 6976495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:30:17+00:00 2026-05-27T17:30:17+00:00

I’m trying to put an example together of using Caliburn Micro on WP7 with

  • 0

I’m trying to put an example together of using Caliburn Micro on WP7 with Ninject. Everything was pretty straight forward. However, I’m stuck on how to go about firing an event once an instance is Activated by Ninject.

Here is the ActivateInstance method in Caliburn Micro’s SimpleContainer, the IoC container that comes with CM for the phone.

 protected virtual object ActivateInstance(Type type, object[] args) {
            var instance = args.Length > 0 ? Activator.CreateInstance(type, args) : Activator.CreateInstance(type);
            Activated(instance);
            return instance;
        }

I register my types in Ninject and when they’re activated I need to fire the Activated event. I looked at interception which might be the route to go but I don’t think dynamic proxy and Linfu is going to work on the phone.

To clarify more, I’m not using the SimpleContainer, the above is to show what SimpleContainer does when an instance is activated. I have a NinjectBootstrapper and a NinjectContainer that implements IPhoneContainer. I can’t figure out how to implement event Action<object> Activated; with Ninject.

update: .OnActivation() looks like the ticket.

Kernel.Bind<IMyService>().To<MyService>().InSingletonScope().OnActivation();
  • 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-05-27T17:30:18+00:00Added an answer on May 27, 2026 at 5:30 pm

    You are on the wrong road. You shouldn’t extend the SimpleContainer and use Ninject to activate the instances. This would mean you are using an IoC container to get the instances for an other IoC container.

    Instead you have to change the Bootstrapper to use Ninject as your IoC container. There are plenty of examples on the web e.g. http://caliburnmicro.codeplex.com/discussions/230861

    To use the Phone specific functions from IPhoneContainer you most likely sill have to put a wrapper around Ninject and implement the methods provided by this interface.


    Update

    You can add an IActivationStrategy as shown in th code below. But make sure you add it as the last strategy in case you have other ones.

    this.Kernel.Components.Add<IActivationStrategy, ActivationNotificationActivationStrategy>();
    this.Kernel.Components.GetAll<IActivationStrategy>()
        .OfType<ActivationNotificationActivationStrategy>()
        .Single().Activated += ...
    
    public class ActivationNotificationActivationStrategy : NinjectComponent, IActivationStrategy
    {
        public event Action<object> Activated;
    
        public void Activate(IContext context, InstanceReference reference)
        {
            if (this.Activated != null)
            {
                this.Activated(reference.Instance);
            }
        }
    
        public void Deactivate(IContext context, InstanceReference reference)
        {
        }
    }
    

    Btw. It would be nice you make the final implemention available somehow so that others can take advantage of your work.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to loop through a bunch of documents I have to put
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.