Is there a friendly and fast way of bind a command to a WPF DataGrid
double click event?
I've used the search box, but all the results I've found had a lot of lines of code and weren't that practical to use.
Is there a friendly and fast way of bind a command to a WPF DataGrid
double click event?
I've used the search box, but all the results I've found had a lot of lines of code and weren't that practical to use.
This is a common desire for implementing Model-View-ViewModel (MVVM) in general, and not easily available out of the box. I haven't used it, but from what I've seen, using the MVVM Light Toolkit will allow you to do things like this.
Or, if you don't want that, there are other schemes as well: WPF: How to bind a command to the ListBoxItem using MVVM?
But, generally speaking, there's no quick and easy ways to do this.
You can't "Bind" events, events belong in the code-behind. There are some work-arounds, you could create some custom behaviors and such, but IMHO if you're jumping through those hoops, you're not doing MVVM properly, you're trying to straddle the fence between event driven and MVVM.
As a simple work around, you can simply add an event handler that calls a method on your view model.