Binding the Loaded event?

后端 未结 5 1153
面向向阳花
面向向阳花 2020-12-24 08:16

I am trying to display a login window once my MainWindow loads while sticking to the MVVM pattern. So I am trying to Bind my main windows Loaded event to an event in my view

5条回答
  •  再見小時候
    2020-12-24 08:39

    You're going to have to use the System.Windows.Interactivity dll.

    Then add the namespace in your XAML:

    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    

    Then you can do stuff like:

    
        
            
        
    
    

    Please note that you will have to use an ICommand (or DelegateCommand is you use Prism, or RelayCommand if you use MVVMLight), and the DataContext of your Window must hold that ICommand.

提交回复
热议问题