Where is the root of the composition in the MDI WPF application?

In traditional MDI applications, some objects (forms) will be created when the command is executed (for example, pressing the ribbon button), so this could be a composition point. In such applications, I am sure that the roots of the composition. I read somewhere that we can use ViewModelLocator , which looks like a Locator template. As you know, the service locator template is denounced by some people.

Now, please advise me about this issue.

Thanks in advance.

+4
source share
1 answer

Regardless of whether ViewModelLocator is a service locator or not, it depends in part on its signature and in part on its role .

In any case, the root of the composition of the WPF application is the OnStartup method - whether the application is an MDI application, change this.

Since you can have any number of child windows in an MDI application, you will most likely need an abstract Factory to create each ViewModel.

+7
source

Source: https://habr.com/ru/post/1393964/


All Articles