I want a command in my ViewModel to be executed when DataGrid item is clicked. As a parameter I want to have corresponding row.
I've found one approach in internet but it using DependencyProperty
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/632ea875-a5b8-4d47-85b3-b30f28e0b827
I don't use DependencyProperty
in my project, instead i'm using INotifyPropertyChanged
. How to implement "double click in datagrid" commaind without using DependencyProperty
?
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
...
<DataGrid SelectedItem={Binding MySelectedItem, Mode=TwoWay}>
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction Command="{Binding YourCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</DataGrid>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With