Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Imports System.ComponentModel
Class BindableRange
Implements INotifyPropertyChanged
Private _EndDate As Date?
Property EndDate As Date?
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