WPF Datagrid Double Click Cell MVVM Design

后端 未结 4 1863
太阳男子
太阳男子 2021-01-03 14:04

I have a WPF application that contains a datagrid. It is bound to my List object \"Orders\" shown below.

public class OrderBlock
{
  public Settings setting;         


        
4条回答
  •  隐瞒了意图╮
    2021-01-03 14:22

    Instead of double-clicking on the cell you may double-click on the grid

    
        
    
    

    In ViewModel

        public ICommand Edit { get; private set; }
    
     Edit = new RelayCommand(EditUser, x => _isAdmin);
    
    
    
     private static void EditUser(object usr)
        {
            if (!(usr is User))
                return;
    
            new UserEditorViewModel(usr as User);
        }
    

提交回复
热议问题