码迷,mamicode.com
首页 > Windows程序 > 详细

Wpf DataGrid MVVM模式实现双击

时间:2016-08-03 21:56:45      阅读:1409      评论:0      收藏:0      [点我收藏+]

标签:

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

Wpf DataGrid MVVM模式实现双击

标签:

原文地址:http://www.cnblogs.com/mujker/p/5734335.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!