Export (0) Print
Expand All

DesignerRegionMouseEventArgs.Region Property

Gets the designer region that was clicked, if any.

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

public DesignerRegion Region { get; }

Property Value

Type: System.Web.UI.Design.DesignerRegion
The DesignerRegion that the click event applies to, or null if no region was clicked.

The Region property represents the control designer region that was clicked, if any.

The Region property is initialized by the DesignerRegionMouseEventArgs constructor.

The following code example shows how to use the DesignerRegionMouseEventArgs to identify the region that was clicked and to change view accordingly. This example is part of a larger example provided for the EditableDesignerRegion class.

// Handler for the Click event, which provides the region in the arguments. 
protected override void OnClick(DesignerRegionMouseEventArgs e)
{
    if (e.Region == null)
        return;

    // If the clicked region is not a header, return 
    if (e.Region.Name.IndexOf("Header") != 0)
        return;

    // Switch the current view if required 
    if (e.Region.Name.Substring(6, 1) != myControl.CurrentView.ToString())
    {
        myControl.CurrentView = int.Parse(e.Region.Name.Substring(6, 1));
        base.UpdateDesignTimeHtml();
    }
}

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft