Binding Commands to Events?

前端 未结 6 2112
清歌不尽
清歌不尽 2020-12-01 06:57

What\'s a good method to bind Commands to Events? In my WPF app, there are events that I\'d like to capture and process by my ViewModel but I\'m not sure how. Things like lo

6条回答
  •  自闭症患者
    2020-12-01 07:35

    Use System.Windows.Interactivity

    …xmlns:i=http://schemas.microsoft.com/expression/2010/interactivity…
    
        
            
                
            
        
    
    

    Make sure your project references the assembly System.Windows.Interactivity.

    Source: MSDN Blog Executing a command from an event of your choice

    [Update] Have a look to to Microsoft.Xaml.Behaviors.Wpf (available since 03.12.2018) Official package by Microsoft.

提交回复
热议问题