iulianchira
asked on
Implementing MVC with Windows Forms
Where can I find a good example on how to completely implement the MVC pattern in Windows Forms. I found many tutorials and code examples on various sites (e.g. CodeProject, .NetHeaven) but many are more representative for the observer pattern than MVC. The application I want to develop is very simple, for a school project so I am not eager to use MVC frameworks like PureMVC.
I have seen a lot of examples for Model-View-Controller and Model-View-Presenter code, so we can find plenty of examples, like this one:
Florida.NET User Group a Success -- Thanks Dave Noderer
http://weblogs.asp.net/scottcate/archive/2006/09/13/Florida.NET-User-Group-a-Success-_2D002D00_-Thanks-Dave-Noderer.aspx
Florida.NET User Group a Success -- Thanks Dave Noderer
http://weblogs.asp.net/scottcate/archive/2006/09/13/Florida.NET-User-Group-a-Success-_2D002D00_-Thanks-Dave-Noderer.aspx
ASKER
In my MVC application I do not want to instantiate the Control in my View and simple have something like MyControll.DoStuff(); in each event handler. I want to decouple things as much as possible.
OK, since you have total control over that, then what is the problem? Decoupling is the very nature that drives selecting MVC/MVP.
Your class can define the View, and attach event handlers, without having that done in the UI.
Your class can define the View, and attach event handlers, without having that done in the UI.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
This question should not be deleted, moreover I provided an answer myself.
ASKER
iulianchira has requested that this question be closed (see the Alert Box above for more details). The question will be closed on 7/19/2009 if there are no objections.
I did not request for the question to be closed. I just said that I provided an answer myself.
I did not request for the question to be closed. I just said that I provided an answer myself.
Another thing is that you can't really get MVC in Windows Forms, because in pure MVC, the user action is actually handled by the Controller, but in Windows Forms, this is handled by the UI control through event (eg. Button1_Click event handler). So you can just think of the event handler as the Controller component.