Base generic implementation of the IView<(Of <(T>)>) interface for windows forms presentation mechanism. Has a strongly typed association to the controller (of the parameter type T).

It is recommended to inherit your Windows view classes from this one instead of manually implementing the IView<(Of <(T>)>) interface.

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

Syntax

C#
public class WinFormView<T> : Form, INotifiedView, 
	IView<T>, IView where T : class, IController
Visual Basic (Declaration)
Public Class WinFormView(Of T As {Class, IController}) _
	Inherits Form _
	Implements INotifiedView, IView(Of T), IView
Visual C++
generic<typename T>
where T : ref class, IController
public ref class WinFormView : public Form, 
	INotifiedView, IView<T>, IView

Type Parameters

T
Specifies the expected type of the associated controller. Must be a subtype of IController

Remarks

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.

Examples

In this example we declare a view type by deriving it from the WinFormView<T> class without a need to manually implement the IView<T> interface.
CopyC#
[WinformsView(typeof(MyTask), MyTask.MyView)]
partial class MyView : WinFormView<MyController>
{
    public MyView()
    {
        InitializeComponent();
    }

    private buttonDoAction_Click(object sender, EventArgs e)
    {
        Controller.MyAction();
    }
}

Inheritance Hierarchy

System..::.Object
  System..::.MarshalByRefObject
    System.ComponentModel..::.Component
      System.Windows.Forms..::.Control
        System.Windows.Forms..::.ScrollableControl
          System.Windows.Forms..::.ContainerControl
            System.Windows.Forms..::.Form
              MVCSharp.Winforms..::.WinFormView<(Of <(T>)>)

See Also