Skip to content

Instantly share code, notes, and snippets.

@vnavarro
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vnavarro/efb819dae3e6b287ba93 to your computer and use it in GitHub Desktop.
Save vnavarro/efb819dae3e6b287ba93 to your computer and use it in GitHub Desktop.
Visual Studio Snippets for Property with NotifyOfPropertyChange
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Notified Property C# - WinPhone</Title>
<Author>Vitor Navarro</Author>
<Description>Full Property shortcut with NotifyOfPropertyChange for WinPhone using C#</Description>
<Shortcut>propfullnotify</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>varType</ID>
<ToolTip>Replace with your property type.</ToolTip>
<Default>int</Default>
</Literal>
<Literal>
<ID>myVar</ID>
<ToolTip>Replace with your attribute name.</ToolTip>
<Default>myVar</Default>
</Literal>
<Literal>
<ID>MyProperty</ID>
<ToolTip>Replace with your property name.</ToolTip>
<Default>MyProperty</Default>
</Literal>
</Declarations>
<Code Language="CSharp">
<![CDATA[private $varType$ $myVar$;
public $varType$ $MyProperty$
{
get { return $myVar$; }
set
{
$myVar$ = value;
NotifyOfPropertyChange(() => $MyProperty$);
}
}
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment