Is ‘event’ a reserved word in JavaScript?

What initially made this confusing for me is not understanding how the conventions for coding event handlers actually worked versus what was a named variable, combined with the implicit calls done by Javascript handlers when you set up event handlers like this: Good 1 document.getElementById(‘testId’).onkeypress = function(e) { console.log(e.which); } Above, your browser is passing … Read more

How do you handle a ComboBox SelectionChanged in MVVM?

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 : <ComboBox ItemsSource=”{Binding Items}”> <i:Interaction.Triggers> <i:EventTrigger EventName=”SelectionChanged”> <i:InvokeCommandAction Command=”{Binding SelectionChangedCommand}”/> </i:EventTrigger> </i:Interaction.Triggers> </ComboBox> Then you just need to implement the SelectionChangedCommand in your viewmodel.