One of my favourite additions to WPF is the Blend Interactivity library which allows you to decorate behaviour into controls in XAML. This really is the glue that allows you to work around MVVM problems in third-party libraries or the framework itself.
The following is an example of a Trigger and Action, to bind SelectedItems to a ViewModel as it changes. This work around is required as SelectedItems isn’t bindable.
One of the most common scenarios for me is the need to execute a command when a control raises a particular event. For instance double-clicking an item in a ListView. The MVVM Light Toolkit has a great TriggerAction called EventToCommand which has been a great help, allowing me to redirect an event and turn it into a command as such:
There are two small short-comings with the original. Firstly that it provides no access to the EventArgs. I have tweaked…
View original post 52 more words