且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何通过命令打开新窗口或用户控件

更新时间:2023-12-05 23:42:28

您可以使用 RelayCommand()


$ b将按钮绑定到命令$ b使用 Application.Current.MainWindow 属性从ViewModel打开子窗口,将新子窗口链接到现有的MainWindow。
You can bind your button to a command using RelayCommand() and

have the child Window being opened from the ViewModel using the Application.Current.MainWindow property to link your new child window to the existing MainWindow.