MVVM and multiple windows

I'm at the pre-design stage of a small application that I would like to write using Caliburn.Micro and C # / WPF. I'm still studying structure, but I like what I see so far.

The application that I intend to create is a process memory search / scan utility, with the ability to demonstrate ASM and the ability to view memory. These are the three problems: search / scan, ASM disassembly, and memory browsing - I would like three or more separate windows to be processed with them. The search / scan part will contain the main shell of the application, and the other two functions (which can be called several times at the same time) will use separate windows caused by the actions of the shell.

My question is this: how can I launch new windows from a shell (or some other) model? I know that I need to transfer another view model for rendering in a new window, but this is a new window business that bothers me.

+3
source share
1 answer

Caliburn.Micro provides the type WindowManagerusing a method Showthat can display the view model in a new window, and if this view model implements the appropriate Caliburn.Micro interfaces, WindowManagerensure the view passes through the normal life cycle (i.e., it calls OnActivate, OnDeactivateetc. .). If your view models are derived from a type Screen, then this will be so.

WindowManager IWindowManager, ShellViewModel.

Window, a UserControl, WindowManager UserControl Window, .

+3

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


All Articles