DesignerRegionMouseEventArgs.Region Property

Definition

Gets the designer region that was clicked, if any.

C#
public System.Web.UI.Design.DesignerRegion Region { get; }

Property Value

The DesignerRegion that the click event applies to, or null if no region was clicked.

Examples

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.

C#
// 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();
    }
}

Remarks

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

The Region property is initialized by the DesignerRegionMouseEventArgs constructor.

Applies to

Produkt Wersje
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also