To setup Ninject:

    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            Runtime
                .Initialize()
                .SetupNinject()
                .Start("Main");
        }
    }

That's it.  Seriously.

Wiring View to ViewModel uses conventions.  So the following types would map:

  • YourNamespace.YourView -> YourNamespace.YourViewModel
  • YourNamespace.Views.YourView -> YourNamespace.ViewModels.YourViewModel

You may also configure Ninject however you wish.  The SetupNinject extension method can also take in an IKernel or multiple assemblies if you need to pull in Views/ViewModels across a few DLLs.

I will add more documentation on using Ninject down the road, but I'd recommend looking at their docs for now.

Last edited Aug 31, 2011 at 3:41 AM by jonathanpeppers, version 2

Comments

No comments yet.