This documentation is archived and is not being maintained.

ReadWriteControlDesigner.OnBehaviorAttached Method

Provides notification when a behavior is attached to the designer.

[Visual Basic]
Overrides Protected Sub OnBehaviorAttached()
[C#]
protected override void OnBehaviorAttached();
[C++]
protected: void OnBehaviorAttached();
[JScript]
protected override function OnBehaviorAttached();

Example

[Visual Basic] The following code example overrides the OnBehaviorAttached method in a designer that inherits from the PanelDesigner class. When this method is called, it checks the value of a custom Panel control's Wrap property. If it is set to true, the MapPropertyToStyle method is called passing the Wrap property and its value as parameters.

[Visual Basic] 
' Override the OnBehaviorAttached method to call
' the MapPropertyToStyle method when the designer
' control's wrap property is set to true.       
 Overrides Protected Sub OnBehaviorAttached()

    MyBase.OnBehaviorAttached()
    
    Dim component As IComponent
  
    Dim panel As CustomPanel = CType(component, CustomPanel)
    Dim wrap As Boolean = panel.Wrap
    If wrap Then
       MapPropertyToStyle("Wrap", wrap)
    End If  
 End Sub 'OnBehaviorAttached

[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

ReadWriteControlDesigner Class | ReadWriteControlDesigner Members | System.Web.UI.Design Namespace

Show: