简体   繁体   English

WPF Windows和MVVM的多个实例

[英]WPF Multiple Instances of Windows and MVVM

How do I use multiple windows in an WPF MVVM app? 如何在WPF MVVM应用程序中使用多个窗口?

I have a Main Window with a menu control that needs to open up new instances of the window each time the item it is selected. 我有一个带有菜单控件的主窗口,每次选择该项目时,它都需要打开该窗口的新实例。 I need to be able to show windows next to each other, it is a requirement and not page or usercontrol navigation. 我需要能够将窗口彼此相邻显示,这是必需条件,而不是页面或用户控件导航。

Does anyone have an example of doing this? 有人有这样做的例子吗?

I've read it is not recommended UI design but it is the requirement I have to implement. 我读过不建议您进行UI设计,但这是我必须实现的要求。

Actually I have this working by using the WindowManager from Caliburn.Micro which seems like an very excellent framework for this type of application. 实际上,我可以使用Caliburn.Micro的WindowManager来完成此工作,对于这种类型的应用程序,这似乎是一个非常出色的框架。 I did look into prism but it seems over complicated and Caliburn is very easy to understand which did meet the requirements. 我确实看过棱镜,但看起来太复杂了,Caliburn很容易理解,哪一个确实满足要求。 I looked into MVVM Light but the documentation is horrible and lacks examples and I don't have time to figure it out. 我研究了MVVM Light,但文档太糟糕了,缺少示例,因此我没有时间弄清楚。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM