tags:

views:

64

answers:

2


Based on the definition of classic MVC pattern, Controller is responsible for handling user inputs and interacting with Models and also determining which View to be rendered.

Wikipedia definition of MVC:
"The controller receives input and initiates a response by making calls on model objects. A controller accepts input from the user and instructs the model and viewport to perform actions based on that input."

According the definition, is it not possible to implement MVC through .NET winforms? Because it's always the View that should recieve the input, even though it can delegate the request to Controller afterwards. In the winforms MVC applications that I have seen so far, this is what happens and the Controller is NOT the one that receives the input directly and determines which View to be rendered.

To me, it seems like all winforms MVC implementations are different variations of MVP and NOT MVC.

(I understand the fact that ASP.NET MVC adheres to classic MVC definition as the controller first receives input through the routing engine, and then determines which View to be rendered etc..)

Can someone clarify? Thanks.

A: 

You are correct MVP pattern is applicable to Winforms, and it works great. A friend had a project with winforms, where he applied the mvp pattern.

I am not sure but I think that MVC cannot be applied to Winforms, and for that reason i think people turned to the different variations of MVP.

Nikola Markezic
+1  A: 

it's always the View that should recieve the input, even though it can delegate the request to Controller afterwards. In the winforms MVC applications that I have seen so far, this is what happens and the Controller is NOT the one that receives the input directly

The Windows Forms designer likes to add event handlers for the controls to the form itself, but you don't have to do it this way. You could use any other class to handle those input events if you wish.

I would definitely recommend using an MVP approach, however. It's relatively easy to set up and has worked out great for me so far.

You may want to read through the answers to the question "How would you implement MVC in a WindowsForms application?" for more information.

Rich