I am faced with a problem that might be known by other developers and I am trying to figure it out and understand it well. It doesn't have to be directly connected to MVVM/WPF, it can also be connected to other methodologies like MVC and MVP .
Lets assume I have a shop cart Model that has its own Service, addItem and deleteItem Methods and calculates the price of the shop cart etc.
Now in my View I display this shop cart and when I want to show the total sum of the shop cart I click on a button to trigger the method that take cares of this.
Here comes the problem: How can I bind the Method (or Command) to the Button? I know that I have to use ICommand
, but by using this interface I kind of break the rules of responsibility separation. How can I implement, without break the rules of the MVVM pattern.