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
7/2/2015 3:23:21 PM
Downloads
526

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