Last active
January 2, 2016 00:09
-
-
Save tanaka-takayoshi/8221618 to your computer and use it in GitHub Desktop.
Code Snipet for MvvmCross ViewModel's property,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>ViewModel Property</Title> | |
<Author>tanaka_733</Author> | |
<Description>The class using this property should inherit Cirrious.MvvmCross.ViewModels.MvxViewModel.</Description> | |
<HelpUrl></HelpUrl> | |
<Shortcut>xprop</Shortcut> | |
</Header> | |
<Snippet> | |
<Declarations> | |
<Literal Editable="true"> | |
<ID>Type</ID> | |
<ToolTip>Property type</ToolTip> | |
<Default>string</Default> | |
<Function> | |
</Function> | |
</Literal> | |
<Literal Editable="true"> | |
<ID>BackingFieldName</ID> | |
<ToolTip>Backing Field name</ToolTip> | |
<Default>myProperty</Default> | |
<Function> | |
</Function> | |
</Literal> | |
<Literal Editable="true"> | |
<ID>InitialValue</ID> | |
<ToolTip>Initial value</ToolTip> | |
<Default>""</Default> | |
<Function> | |
</Function> | |
</Literal> | |
<Literal Editable="true"> | |
<ID>PropertyName</ID> | |
<ToolTip>Property name</ToolTip> | |
<Default>MyProperty</Default> | |
<Function> | |
</Function> | |
</Literal> | |
</Declarations> | |
<Code Language="csharp"> | |
<![CDATA[private $Type$ $BackingFieldName$ = $InitialValue$; | |
public $Type$ $PropertyName$ | |
{ | |
get | |
{ | |
return $BackingFieldName$; | |
} | |
set | |
{ | |
if ($BackingFieldName$ == value) | |
{ | |
return; | |
} | |
$BackingFieldName$ = value; | |
RaisePropertyChanged(() => $PropertyName$); | |
} | |
}]]></Code> | |
</Snippet> | |
</CodeSnippet> | |
</CodeSnippets> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment