更新时间:2023-11-29 20:35:28
您需要将MainWindow_2所在的命名空间的引用添加到MainWindow_1的代码中。如果MainWindow_2在一个单独的程序集中,您可能也需要引用该程序集。
[OP已更新代码问题]
MainWindow_2 win2 = new MainWindow_2.Show()
应该是
MainWindow_2 win2 = new MainWindow_2() .Show()
You need to add a reference to the namespace that MainWindow_2 is in to the code for MainWindow_1. If MainWindow_2 is in a separate assembly, you may need to reference that assembly as well.
[OP has updated question with code]
MainWindow_2 win2 = new MainWindow_2.Show()
Should be
MainWindow_2 win2 = new MainWindow_2().Show()
只需按Ctrl +。在MainWindow_2
中的行MainWindow_2 win2 = new MainWindow_2();
它将解决你的名字空间(如果dll已经是项目的一部分)。
Just press Ctrl + . onMainWindow_2
in the lineMainWindow_2 win2 = new MainWindow_2();
It will resolve your name space (if the dll is already part of the project).