コンポーネント変更済みイベントを処理するデリゲート。
Overrides Public Sub OnComponentChanged( _
ByVal sender As Object, _ ByVal ce As ComponentChangedEventArgs _)
[C#]
public override void OnComponentChanged(objectsender,ComponentChangedEventArgsce);
[C++]
public: void OnComponentChanged(Object* sender,ComponentChangedEventArgs* ce);
[JScript]
public override function OnComponentChanged(
sender : Object,ce : ComponentChangedEventArgs);
パラメータ
- sender
イベントを送っているオブジェクト。 - ce
イベントに対してデータを提供する ComponentChangedEventArgs 。
解説
これは、プロパティが変更された後に呼び出されます。これを使用すると、インプリメンタはプロパティの変更後に必要になる場合がある後処理を実行できます。
使用例
[Visual Basic] OnComponentChanged メソッドをオーバーライドして、変更されたプロパティの名前をチェックするコード例を次に示します。この名前が DataSource または DataMember の場合は、カスタムの OnDataSourceChanged メソッドが呼び出され、デザイン時に使用されるデータ テーブルが null 参照 (Visual Basic では Nothing) に設定されます。名前が ItemStyle の場合は、カスタムの OnStylesChanged メソッドが呼び出され、その中で、デザイナに関連付けられているテンプレート編集動詞コレクションが変更されたことをデザイナに伝えるメソッドが呼び出されます。
' 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] C#、C++、および JScript のサンプルはありません。Visual Basic のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ
.NET Framework セキュリティ:
- 直前の呼び出し元の完全信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細の参照先 : 部分信頼コードからのライブラリの使用
参照
TemplatedControlDesigner クラス | TemplatedControlDesigner メンバ | System.Web.UI.Design 名前空間