WPF and Inversion of Control: Listing 2.

The Windsor facility.

public class ViewActivatorFacility : AbstractFacility
  protected override void Init()
    Kernel.ComponentModelCreated += 

  void Kernel_ComponentModelCreated(Castle.Core.ComponentModel model)
    var isView = typeof(IView).IsAssignableFrom(model.Service);
    if (!isView) return;

    if (model.CustomComponentActivator == null)
      model.CustomComponentActivator = typeof(WPFWindowActivator);

About the Author

Patrick Steele is a senior .NET developer with Billhighway in Troy, Mich. A recognized expert on the Microsoft .NET Framework, he’s a former Microsoft MVP award winner and a presenter at conferences and user group meetings.

comments powered by Disqus