How do I pass the information from View to ViewModel with DelegateCommand?

前端 未结 5 1627
感情败类
感情败类 2021-02-02 18:16

In my View, I have a button.

When the user clicks this button, I want to have the ViewModel save the context of the TextBlock in the database.



        
5条回答
  •  你的背包
    2021-02-02 18:31

    In your VM:

    private DelegateCommand _saveCmd = new DelegateCommand(Save);
    
    public ICommand SaveCmd{ get{ return _saveCmd } }
    
    public void Save(string s) {...}
    

    In you View, use CommandParameter like Matt's example.

提交回复
热议问题