-
-
Save AnthonyDGreen/a4fa8cfc17373c6021df8b30d7436123 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.ComponentModel | |
Class BindableRange | |
Implements INotifyPropertyChanged | |
Private _EndDate As Date? | |
Property EndDate As Date? | |
Get | |
Return _EndDate | |
End Get | |
Set(value As Date?) | |
' This line here: | |
If value = _EndDate Then Return | |
_EndDate = value | |
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(NameOf(EndDate))) | |
End Set | |
End Property | |
Public Event PropertyChanged As PropertyChangedEventHandler _ | |
Implements INotifyPropertyChanged.PropertyChanged | |
End Class | |
Module Program | |
WithEvents Range As New BindableRange | |
Sub Main() | |
Range.EndDate = Today | |
Range.EndDate = Today | |
Range.EndDate = Nothing | |
Range.EndDate = Nothing | |
End Sub | |
Private Sub BindableRange_PropertyChanged(sender As Object, e As PropertyChangedEventArgs) _ | |
Handles Range.PropertyChanged | |
Console.WriteLine(e.PropertyName & " changed.") | |
End Sub | |
End Module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment