views:

70

answers:

1

my View constructor:

public View1(IRegionManager regionManager, IUnityContainer container, bool myParam)
{
}

How to set myParam when I do Resolve<View1>()? Thank you.

+2  A: 

You need to register the type with Unity and specify all the arguments:

this.container.RegisterType<View1>(new InjectionConstructor(this.container.Resolve<IRegionManager>(), this.container,true));

Then it'll know how to resolve it. Kind of defeats the purpose a little, which is why you may be better off setting the bool value as a property, and using InjectionProperty instead.

BFree
I tried with RegisterType but still no luck. Thank you, now I'm using interface and property to set the variable.
Jeaffrey Gilbert