This is a VB.NET translation of using ActiveSharp's PropertyChangeHelper from VB.NET. It was kindly sent in by Andrew Backer.

    Private _propertyChangeHelper As New PropertyChangeHelper

    Public Custom Event PropertyChanged As PropertyChangedEventHandler _
        Implements INotifyPropertyChanged.PropertyChanged
        AddHandler(ByVal value As PropertyChangedEventHandler)
        End AddHandler
        RemoveHandler(ByVal value As PropertyChangedEventHandler)
        End RemoveHandler
        RaiseEvent(ByVal sender As Object, ByVal e As PropertyChangedEventArgs)
             '-- empty! (this is the key to doing it VB - you must write RaiseEvent, but since the helper raises
             ' the event, you don't have to do anything here yourself)
        End RaiseEvent
    End Event

    Public Sub SetValue(Of t)(ByRef field As t, ByVal value As t)
        _propertyChangeHelper.SetValue(Me, field, value)
    End Sub

Last edited Dec 24, 2008 at 3:28 AM by johnrusk, version 3


sfmskywalker Apr 19, 2012 at 11:49 AM