ControlDesigner.OnComponentChanged Method
Called when the component changes.
[Visual Basic] Public Overridable Sub OnComponentChanged( _ ByVal sender As Object, _ ByVal ce As ComponentChangedEventArgs _ ) [C#] public virtual void OnComponentChanged( object sender, ComponentChangedEventArgs ce ); [C++] public: virtual void OnComponentChanged( Object* sender, ComponentChangedEventArgs* ce ); [JScript] public function OnComponentChanged( sender : Object, ce : ComponentChangedEventArgs );
Parameters
- sender
- The source of the event.
- ce
- A ComponentChangedEventArgs that contains the event data.
Remarks
This method is called when a property is changed. It allows the implementer to do any processing that may be needed after a property change.
Example
[Visual Basic] The following code example overrides the OnComponentChanged method in a templated data-bound control designer. The code processes changes to the control's DataSource property value and changes to the control's Style property.
[Visual Basic]
' Override the OnComponentChanged method to change
' the control's DataSource or styles in the designer.
Public Overrides Sub OnComponentChanged(sender As Object, e As ComponentChangedEventArgs)
If Not (e.Member Is Nothing) Then
Dim memberName As String = e.Member.Name
If memberName.Equals("DataSource") Or memberName.Equals("DataMember") Then
OnDataSourceChanged()
Else
If memberName.Equals("ItemStyle") Then
OnStylesChanged()
End If
End If
End If
MyBase.OnComponentChanged(sender, e)
End Sub
' Create a method that sets the data table
' associated with the templates to nothing.
Protected Overridable Sub OnDataSourceChanged()
designTimeDataTable = Nothing
End Sub
' Create a method that determines whether the designer
' verbs associated with the control's templates have
' changed.
Protected Sub OnStylesChanged()
OnTemplateEditingVerbsChanged()
End Sub
' Create a method that notifies all callers
' that the designer verbs collection has changed.
Protected Sub OnTemplateEditingVerbsChanged()
templateVerbsDirty = True
End Sub
[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
.NET Framework Security:
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries From Partially Trusted Code
See Also
ControlDesigner Class | ControlDesigner Members | System.Web.UI.Design Namespace | ComponentChanged