views:

1409

answers:

1

We're using Views and ViewModels in this project, and as a result we're trying to have as little in the code-behind for the View as possible.

I'm trying to tie the MouseDoubleClick event for a WPFToolkit Datagrid to the same code that a button in the same view already is using.

The button is declared as the following:

<Button Content="Select" cmd:ButtonBaseExtensions.Command="{Binding CommandViewEmployer}"/>

which means it runs the CommandViewEmployer Property in the ViewModel. How do I get the Grid MouseDoubleClick to run the same property? I've tried adding MouseDoubleClick="{Binding CommandViewEmployer}", which errors.

I'm trying to get this in as little code-behind as possible, none preferably.

A: 

You can use something like Marlon Grech's attached command behaviors.

HTH, Kent

Kent Boogaart