0
behiunforgiven created
In WPF Sample there is only one form. How can I create another form and use dependency injection ?
for example:
private readonly IPersonAppService _personAppService;
public MainForm(IPersonAppService personAppService)
{
_personAppService = personAppService;
InitializeComponent();
}
how can I create a new MainForm(and showdialog) ?
1 Answer(s)
-
0
Hi,
You can create forms similar to MainForm. You need to derive your forms from Form and ITransientDependency.
When you want oto create a new form, get it from dependency injection like this. var form = IocManager.Instance.IocContainer.Resolve<YourNewFormForm>();