Skip to content

How to open a child window without needing to update app.axaml? #19115

Closed Answered by stevemonaco
Shadowblitz16 asked this question in Q&A
Discussion options

You must be logged in to vote

1. How do I connect IWindowManager to IWindowFactory?

In your concrete implementation, one will have a constructor to take the other. Likely public WindowManager(IWindowFactory windowFactory).

2. How do I get the view from the view model?

You can create a mapping in your View layer. Cleanup to prevent leaks may be difficult.

You can also use DI scoping to create a scope per window and register certain services as scoped. When the service is injected, it will be associated with the right window behind-the-scenes as long as the ViewModel doesn't get transferred across windows. I found that approach to be very challenging, but I also had several other wiring concerns. It does work very well …

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Shadowblitz16
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@thevortexcloud
Comment options

@Shadowblitz16
Comment options

Comment options

You must be logged in to vote
2 replies
@thevortexcloud
Comment options

@Shadowblitz16
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants