Skip to content

Instantly share code, notes, and snippets.

@formix
Created November 26, 2018 17:03
Show Gist options
  • Save formix/dcf1f80d20e61a819992c83963754bd4 to your computer and use it in GitHub Desktop.
Save formix/dcf1f80d20e61a819992c83963754bd4 to your computer and use it in GitHub Desktop.
ViewModel property snippet for visual studio 2017
<?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>View Model Property</Title>
<Description>
Declares a property and member suitable for Viewmodel implementation.
</Description>
<HelpUrl>
</HelpUrl>
<Shortcut>propvm</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal Editable="true">
<ID>propname</ID>
<ToolTip>Property Name</ToolTip>
<Default>Name</Default>
<Function>
</Function>
</Literal>
<Literal Editable="true">
<ID>type</ID>
<ToolTip>Property type.</ToolTip>
<Default>Type</Default>
<Function>
</Function>
</Literal>
</Declarations>
<Code Language="csharp" Kind="type decl"><![CDATA[
public $type$ $propname$
{
get => Get<$type$>(nameof($propname$));
set => Set(nameof($propname$), value);
}
$end$]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
@formix
Copy link
Author

formix commented Nov 26, 2018

Works with the ViewModelMase.cs class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment