I've data bound a ListBox in my MVVM Light Windows Phone 7 app, and want to invoke a command in my view model when the user clicks on an item in my ListBox.
I'm doing this using the EventToCommand behaviour and everything is good, except that I can't pass the data item associated with the list element that was clicked, if I use the MouseLeftButtonDown event ...
If I use the SelectionChanged event, then I can bind the behaviour's CommandParameter to the ListBox's SelectedItem, but I really want to use the MouseLeftButtonDown event.
Any ideas? I'd prefer not to pollute my View Model by setting the "PassEventArgsToCommand" option, and in any event I'm not sure I can get the selected data item from the MouseButtonEventArgs.
Right now I'm heading towards setting up an event handler in the code-behind, and invoking the ViewModel from there, using the "sender" to get at the data item.
Thanks,
Damian