conditional-binding

Parameter based bindings in ninject 2.0

I want to use conditional binding in ninject, based on passed parameters. I have something like below: public class Subject { } public interface ITarget { } public class Target1 : ITarget { } public class Target2 : ITarget { } And now I need to instantiate ITarget interface: public void MethodName(IKernel kernel) { ...

Contextual bindings with Ninject 2.0

In Ninject 1.0 I had following binding definitions: Bind<ITarget>().To<Target1>().Only(When.Context.Variable("variable").EqualTo(true)); Bind<ITarget>().To<Target2>(); Given such bindings I had calls: ITarget target = kernel.Get<ITarget>(With.Parameters.ContextVariable("variable", true)); ITarget target = kernel.Get<ITarget>(With.Par...

How do you conditionally bind data?

How do I conditionally bind data to a combo box? I have a combo box that by default should display an ID. However, if the user checks a check box then the display should display both the ID and a NAME. For example, "OO1: Sam". I have the default ID displaying correctly. I'm just not sure how to get both the ID and the NAME to display bas...