Base implementation of the IView interface for windows forms presentation mechanism. Inherit your view classes from this one and override IView members if necessary.

Namespace:  MVCSharp.Winforms
Assembly:  MVCSharp (in MVCSharp.dll)
Version: 0.8.5217.34148


public class WinFormView : Form, IView, 
Visual Basic (Declaration)
Public Class WinFormView _
	Inherits Form _
	Implements IView, INotifiedView
Visual C++
public ref class WinFormView : public Form, 
	IView, INotifiedView


This class also implements INotifiedView interface, which tells the views manager to notify the view on such events as view initialization and activation. Default implementation methods do nothing but descendant classes may override them to add some functionality.

It is recommended to use the generic version of this class - WinFormView<(Of <(T>)>) - with a strongly typed association to the controller and, thus, higher type safety.


In this example we declare a view type by deriving it from the WinFormView class without a need to manually implement IView interface.
[WinformsView(typeof(MyTask), MyTask.MyView)]
partial class MyView : WinFormView
    public MyView()

    private buttonDoAction_Click(object sender, EventArgs e)
        (Controller as MyController).MyAction();

Inheritance Hierarchy

See Also