MVVM Light RelayCommand Parameters

后端 未结 3 1486
[愿得一人]
[愿得一人] 2020-11-29 06:11

I\'m having an issue with passing a parameter to a relaycommand using the GalaSoft MVVM Light framework. I know that mvvm light\'s implementation of relaycommand doesn\'t u

3条回答
  •  旧巷少年郎
    2020-11-29 06:47

    I believe this will work:

    _projmenuItem_Edit = new RelayCommand((txt)=>ProjEditNode(txt));
    
    
    

    -- EDIT --

    You'll need to define your RelayCommand with the type as well:

    e.g.

    public RelayCommand myCommand { get; private set; }
    myCommand = new RelayCommand((s) => Test(s));
    
    private void Test(string s)
    {
        throw new NotImplementedException();
    }
    

    提交回复
    热议问题