ControlDesigner::ViewControl Property
Gets or sets a Web server control that can be used for previewing the design-time HTML markup.
Assembly: System.Design (in System.Design.dll)
The ViewControl property uses the UsePreviewControl property to determine its return value.
If the UsePreviewControl property is true, the ViewControl property returns a temporary copy of the control. Changes to the temporary control are not persisted.
If the UsePreviewControl property is false, the ViewControl property returns an instance of the Component property for the control. Changes to the instance of the control are persisted.
The SupportsPreviewControl setting in the SupportsPreviewControlAttribute object is used to set the value of the UsePreviewControl property. Therefore, the SupportsPreviewControl setting determines the type of control that is returned by the ViewControl property in the base ControlDesigner class. If the SupportsPreviewControlAttribute is not specified in the control designer declaration, the ControlDesigner object behavior is equivalent to specifying the SupportsPreviewControl property as false.
The following code example demonstrates how to mark a control designer with the SupportsPreviewControlAttribute attribute. The code example derives a Web server control from the Label class and associates the control with a custom control designer implementation. The control designer class declaration is marked with the SupportsPreviewControl attribute set to true. The control designer overrides the GetDesignTimeHtml method, and then displays the Text property of the control in italic at design time.
Available since 2.0