Notifies clients that a property value has changed.
Syntax
Event Data
The event handler receives an argument of type PropertyChangedEventArgs containing data related to this event. The following PropertyChangedEventArgs properties provide information specific to this event.
Property | Description |
---|
PropertyName | Gets the name of the property that changed. |
Example
This example handles the PropertyChanged event.
Visual Basic | Copy Code |
---|
Public Sub WebImageViewer_PropertyChanged(ByVal mainWebImageViewer As WebImageViewer)
AddHandler mainWebImageViewer.PropertyChanged, New System.ComponentModel.PropertyChangedEventHandler(AddressOf mainWebImageViewer_PropertyChanged)
''
'' update some properties values
''
AddHandler mainWebImageViewer.PropertyChanged, New System.ComponentModel.PropertyChangedEventHandler(AddressOf mainWebImageViewer_PropertyChanged)
End Sub
Sub mainWebImageViewer_PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs)
If (e.PropertyName = "ScaleFactor") Then
'' ScaleFactor property changed.
ElseIf (e.PropertyName = "SizeMode") Then
'' SizeMode property changed.
''
''etc.
''
End If
End Sub |
C# | Copy Code |
---|
public void WebImageViewer_PropertyChanged(WebImageViewer mainWebImageViewer)
{
mainWebImageViewer.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(mainWebImageViewer_PropertyChanged);
//
// update some properties values
//
mainWebImageViewer.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(mainWebImageViewer_PropertyChanged);
}
void mainWebImageViewer_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if(e.PropertyName == "ScaleFactor")
{
// ScaleFactor property changed.
}
else if(e.PropertyName == "SizeMode")
{
// SizeMode property changed.
}
//
//etc.
//
} |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7
See Also