Menu
  • HOME
  • TAGS

How to register a class with a dependency injected constructor? (SimpleIoC)

c#,dependency-injection,mvvm-light,ioc-container,viewmodellocator

You can't registered interface alone like this. You have register an interface with implementation of it: class YourImplement: IEnumerable { .... } SimpleIoc.Default.Register<IEnumerable, YourImplement>(); Or this: SimpleIoc.Default.Register<IEnumerable>(()=>new YourImplement()); ...

Passing parameter between ViewModels using MVVMLight

c#,silverlight,windows-phone-8.1,mvvm-light,viewmodellocator

I would suggest creating the SecondViewModel immediately as soon as it is registered in the ViewModelLocator. You can do that by using a overloaded method of Register. SimpleIoc.Default.Register<SecondViewModel>(true); This will make sure that ensure that the Messenger registration happens before the message is sent....