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

前端 未结 5 1610
感情败类
感情败类 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:43

    I'm not allowed to make comments yet, I guess. I'm responding to Carlos' suggestion because I tried it out. While it's a great idea, DelegateCommand would need to be modified in some way because otherwise you'll get this error: A field initializer cannot reference the non-static field, method, or property 'MyViewModel.Save(string)'.

提交回复
热议问题