Skip to content

Instantly share code, notes, and snippets.

@tanaka-takayoshi
Created September 23, 2012 06:34
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 tanaka-takayoshi/3769103 to your computer and use it in GitHub Desktop.
Save tanaka-takayoshi/3769103 to your computer and use it in GitHub Desktop.
VS2012 のテンプレートにある BindableBase を実装したクラスのプロパティを書くためのスニペット
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>BindableProperty を定義します</Title>
<Shortcut>propb</Shortcut>
<Description>DependencyProperty をバッキング ストアとして使用するプロパティのコード スニペット</Description>
<Author>Microsoft Corporation</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>type</ID>
<ToolTip>プロパティ型</ToolTip>
<Default>int</Default>
</Literal>
<Literal>
<ID>property</ID>
<ToolTip>プロパティ名</ToolTip>
<Default>MyProperty</Default>
</Literal>
<Literal>
<ID>field</ID>
<ToolTip>このプロパティのバッキング変数</ToolTip>
<Default>myVar</Default>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[private $type$ $field$;
public $type$ $property$
{
get { return this.$field$; }
set { this.SetProperty(ref this.$field$, value); }
}
$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment