Export (0) Print
Expand All

ConnectionsZoneDesigner Class

Provides design-time support for ConnectionsZone controls.

Namespace:  System.Web.UI.Design.WebControls.WebParts
Assembly:  System.Design (in System.Design.dll)

public class ConnectionsZoneDesigner extends ToolZoneDesigner

ConnectionsZoneDesigner provides a design-time representation of a ConnectionsZone control with a menu to access the AutoFormats collection and the ViewInBrowseMode property for the convenience of the page developer. It is the only zone designer that does not support designer regions. This is because ConnectionsZone controls uses links to create connections instead of a drag-and-drop user interface (UI).

The AutoFormats collection and the ViewInBrowseMode property both appear on the verbs menu of the ConnectionsZone control. AutoFormats, when selected, provides a selection of color schemes. The ViewInBrowseMode check box, when selected, displays the contents of the control as it would appear in the browser; the control will be empty until a connection is made.

You can inherit from ConnectionsZoneDesigner to support a custom ConnectionsZone control as with any other control designer. You can override the GetDesignTimeHtml method to change the markup that renders the control. You can also override the AutoFormats collection to add a DesignerAutoFormatCollection with a custom scheme.

The following code example shows how to hide additional properties from a custom ConnectionsZone control by overriding the PreFilterProperties method.

using System;
using System.Security.Permissions;
using System.Web;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.Design.WebControls.WebParts;
using System.ComponentModel;
using System.Collections;

/// <summary> 
/// ConnectionsZoneSample provides a blank inheritance of 
/// the ConnectionsZone class for the purpose of attaching 
/// a custom designer. 
/// ConnectionsZoneSampleDesigner shows how to edit the 
/// PreFilterProperties() method to hide a specific property 
/// at design time. 
/// </summary> 
namespace Samples.AspNet.CS.Controls
{
    [AspNetHostingPermission(SecurityAction.Demand,
      Level = AspNetHostingPermissionLevel.Minimal)]
    [AspNetHostingPermission(SecurityAction.InheritanceDemand,
      Level = AspNetHostingPermissionLevel.Minimal)]
    [Designer(typeof(ConnectionsZoneSampleDesigner))]
    public class ConnectionsZoneSample : ConnectionsZone {}
    public class ConnectionsZoneSampleDesigner : ConnectionsZoneDesigner
    {
        // Here is the property we will hide.
        string propertyToHide = "BackColor";

        protected override void PreFilterProperties(IDictionary properties)
        {
            // Invoke the base method. This will hide those properties 
            // specified in ConnectionsZoneDesigner. 
            base.PreFilterProperties(properties);

            // Set attributes to remove it from the property grid and any editors.
            Attribute[] newAttributes = new Attribute[] 
            {   new BrowsableAttribute(false),
                new EditorBrowsableAttribute(EditorBrowsableState.Never)};

            PropertyDescriptor property = (PropertyDescriptor)properties[propertyToHide];
            if (property != null)
            {
                // Re-create the property with the attributes specified above.
                properties[propertyToHide] = TypeDescriptor.CreateProperty(property.ComponentType, property, newAttributes);
            }
        }
    }
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft