How do you handle a ComboBox SelectionChanged in MVVM?

前端 未结 3 1973
南旧
南旧 2020-12-13 06:45

For those doing pure MVVM, how do you handle a ComboBox SelectionChanged event without reverting to code behind?

I tried e.g. AttachedBehaviors but Event=\"SelectedC

3条回答
  •  再見小時候
    2020-12-13 07:12

    This post is quite old, but since I got the same issue. Here is how I solved it (using framework 4.0) : the idea is to use System.Windows.Interactivity.

    In the XAML :

    
        
            
                
            
        
    
    

    Then you just need to implement the SelectionChangedCommand in your viewmodel.

提交回复
热议问题