标签:
Instead of double-clicking on the cell you may double-click on the grid
1 <DataGrid.InputBindings>
2 <MouseBinding Gesture="LeftDoubleClick" Command="{Binding Edit}" CommandParameter="{Binding ElementName=UsersDataGrid, Path=SelectedItem}" />
3 </DataGrid.InputBindings>
In ViewModel
1 public ICommand Edit { get; private set; }
2
3 Edit = new RelayCommand(EditUser, x => _isAdmin);
4
5 private static void EditUser(object usr)
6 {
7 if (!(usr is User))
8 return;
9
10 new UserEditorViewModel(usr as User);
11 }
转自:http://stackoverflow.com/questions/18595654/wpf-datagrid-double-click-cell-mvvm-design
标签:
原文地址:http://www.cnblogs.com/mujker/p/5734335.html