Define a Property with Notify PropertyChanged


Snippet Details

Shortcut
pn
Description
Defines a Property with a backing field which notifies (raises) the PropertyChanged event.
Language
VB
Author
Fons Sonnemans
Upload on
2-7-2015 15:23:21
Downloads
2139

Declarations

ID ToolTip Default
PropertyName Replace with property name. NewProperty
PropertyType Replace with the property type. String

Code Output

        Private $PrivateVariable$ As $PropertyType$
Public Property $PropertyName$() As $PropertyType$
    Get
        Return $PrivateVariable$ 
    End Get
    Set(ByVal value As $PropertyType$)
        If Not $PrivateVariable$ = value Then
           $PrivateVariable$ = value
           OnPropertyChanged(NameOf($PropertyName$))
        End If
    End Set
End Property
    

Download Add to .VSIX Package


comments powered by Disqus

Extension Package

No snippets are added


Languages