Skip to content

Instantly share code, notes, and snippets.

@cmorgado
Created September 26, 2014 22:29
Show Gist options
  • Save cmorgado/5e0d114de1b9c1605167 to your computer and use it in GitHub Desktop.
Save cmorgado/5e0d114de1b9c1605167 to your computer and use it in GitHub Desktop.
VS2013 Snippet to easily create your RelayCommand using MVVM Light
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
<Title>relrt</Title>
<Author>Cristovao Morgado</Author>
<Description>Code snippet for an automatically implemented Relaycommands
Language Version: C# 4.5 or higher</Description>
<HelpUrl>
</HelpUrl>
<Shortcut>relrt</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal Editable="true">
<ID>type</ID>
<ToolTip>Property type</ToolTip>
<Default>string</Default>
<Function>
</Function>
</Literal>
<Literal Editable="true">
<ID>property</ID>
<ToolTip>Property name</ToolTip>
<Default>MyProperty</Default>
<Function>
</Function>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[
private RelayCommand _$property$;
public RelayCommand $property$ {
get { return _$property$ ?? (_$property$ = new RelayCommand(
async () =>
{
try
{
}
catch (Exception ex)
{
throw ex;
}
finally
{
}
}));}
}
$end$]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment