Home > Software design >  Is it possible to specify a dependency injection container for Visual Studio designer
Is it possible to specify a dependency injection container for Visual Studio designer

Time:09-17

So that the Visual Studio designer calls the dependency injection container instead of using the default constructor when showing the GUI of a XAML file

CodePudding user response:

No, I don't think so, but you should be able to use the GetIsInDesignMode property to detect whether you're in design mode and set up your dependencies accordingly:

public YourView()
{
    ...
    if (DesignerProperties.GetIsInDesignMode(this))
    {
        //set up design time dependencies here...
    }
}
  • Related