自分用のメモ。
MvvmLightを使うこと前提
環境を変えるたびに探すので。
短くコンパクトにできるのがポイント。これがないと捗らぬ。
vmprop.snippet
<?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>prop for ViewModel</Title>
<Author>kiichi</Author>
<Description>prop for ViewModel</Description>
<HelpUrl>http://www.mvvmlight.net</HelpUrl>
<Shortcut>vmprop</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal Editable="true">
<ID>property</ID>
<ToolTip>Property Name</ToolTip>
<Default>MyProperty</Default>
<Function>
</Function>
</Literal>
<Literal Editable="true">
<ID>type</ID>
<ToolTip>Property Type</ToolTip>
<Default>int</Default>
<Function>
</Function>
</Literal>
<Literal Editable="true">
<ID>defaultvalue</ID>
<ToolTip>The default value for this property.</ToolTip>
<Default>0</Default>
<Function>
</Function>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[
public $type$ $property${get{return _$property$;}set{Set(ref _$property$,value);}}
private $type$ _$property$ = default($type$);
]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
RelayCommand.snippet
<?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>RelayCommand</Title>
<Author>kiichi</Author>
<Description>Creates and initializes a new RelayCommand with an Execute lambda. (V5.2.4.0)</Description>
<HelpUrl>http://www.mvvmlight.net</HelpUrl>
<Shortcut>relayCommand</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal Editable="true">
<ID>commandname</ID>
<ToolTip>Name of the RelayCommand.</ToolTip>
<Default>MyMethod</Default>
<Function>
</Function>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[
private void $commandname$()
{
}
#region $commandname$ Command
/// <summary>
/// Gets the $commandname$.
/// </summary>
public RelayCommand $commandname$Command
{
get{return _$commandname$Command ?? (_$commandname$Command = new RelayCommand(() =>{$commandname$(); }));}
}
private RelayCommand _$commandname$Command;
#endregion
]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>