Links controller to its view. The framework takes care of setting
this property for every controller instance. Thus, in full
accordance to the Model-View-Presenter pattern, any controller
may access its view (see the example in the bottom).
Namespace:
MVCSharp.CoreAssembly: MVCSharp (in MVCSharp.dll)
Version: 0.8.5217.34148
Syntax
Remarks
The setter method of the View property is often used
to do the necessary view initialization:
CopyC#
class MyController : ControllerBase { public override IView View { get { return base.View; } set { base.View = value; // Do view initialization } } }
Examples
Here we access the view from the controller:
CopyC#
class MyController : ControllerBase { public void DoSomething() { if ((View as IMyView).InputValue < 0) MessageBox.Show("The input value should be not negative."); else (View as IMyView).OutputValue = Math.Sqrt((View as IMyView).InputValue); } }