How to open a new window using MVVM Light Toolkit

后端 未结 6 902
青春惊慌失措
青春惊慌失措 2020-11-27 11:50

I am using MVVM Light toolkit in my WPF application. I would like to know what is the best approach for opening a new window from an existing window. I have got this M

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 12:35

    You can do in this way like you need to create some events and register those in view and call these in view model.and open that pop up window.

    Like This example

    public class Mainclass : MainView
    {
        public delegate abc RegisterPopUp(abc A);
        public RegisterPopUp POpUpEvent ;
    
        public RelayCommand ShowCommand { private set; get; }  
    
    
        public void ShowCommand() 
        { 
            ShowCommand("Your parameter");
        } 
    }
    

    inside the view MainView mn=new MainView();

    Register the event here like thake mn.POpUpEvent += than click on tab button double time

    and in registers popup method right the code for opening the pop up window.

提交回复
热议问题