4

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.

1
  • ButtonBaseExtensions.Command seems to be an attached property. Why don't you change is to handle DoubleClick on any element (and not only button) ? Commented Sep 10, 2009 at 7:32

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.