我正在努力在应用中实现一些类似Chrome的标签功能,并且在使新实例正确生成时遇到一些麻烦.我已经做了很多搜索和迭代各种解决方案,但还没有能够在第二台显示器上生成一个新的窗口.
这是使用线程:
断开连接在步骤3中.新实例始终在主监视器上生成.
所以,一些代码可以扩展问题.
namespace app {
public class AppView {
public void OpenInNewWindow()
{
// Create a new viewmodel
var appViewModel = new AppVM();
//// On my machine this returns the correct screen "DISPLAY2". The Top and Left properties are 0 and 1680, respectively.
var targetScreen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
////So we can set the position of the new view
var appView = new AppView(appViewModel);
//This seats the currently selected data tab inside the new AppViewModel
RelocateSelectedViewModel(appViewModel);
appView.WindowStartupLocation …Run Code Online (Sandbox Code Playgroud)