标签:
概念:

<CodeSnippet Format="1.0.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<Header>
<Title>标题</Title>
<Author>作者</Author>
<Shortcut>快捷方式</Shortcut>
<Description>说明</Description>
<SnippetTypes>
<SnippetType>SurroundsWith</SnippetType>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>名称</ID>
<Default>值</Default>
</Literal>
</Declarations>
<Code Language="XML">
<![CDATA[<test>
<name>$名称$</name>
$selected$ $end$</test>]]>
</Code>
</Snippet>
</CodeSnippet>
|
<Header>子元素
|
定义
|
|
<Title>
|
显示标题
|
|
<Shortcut>
|
为代码段定义的快捷方式。 在IDE中,输入快捷方式名称然后通过tab键选择下面的代码段,如果你输入部分快捷方式 名称(例如“cla”而不是“class”),你将需要按两次tab键;一次完成名称扩展,另外 一次插入代码段 |
|
<Description>
|
关于代码段的描述信息
|
|
<SnippetType>
|
指定代码段所属的类别(扩展,围绕,或重构)。注意,一个代码段可能属于多个组。 微软IDE根据这个值决定使用哪个显示代码段的上下文菜单 |
|
<Literal>的子节点
|
定义节点
|
|
<ID>
|
变量名称,生成后用于统一替换代码段中的内容
|
|
<ToolTip>
|
鼠标移动到上面的提示信息
|
|
<Default>
|
变量的默认值
|
<CodeSnippet Format="1.0.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<Header>
<Title>MySnippet</Title>
<Author>infly</Author>
<Shortcut>dprop</Shortcut>
<Description>自动生成依赖属性</Description>
<SnippetTypes>
<SnippetType>SurroundsWith</SnippetType>
<SnippetType>Expansion</SnippetType>
<SnippetType>Refactoring</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>PropertyName</ID>
<Default>propertyName</Default>
<ToolTip>Replace with property name.</ToolTip>
</Literal>
<Literal>
<ID>PropertyType</ID>
<Default>propertyType</Default>
<ToolTip>Replace with property type.</ToolTip>
</Literal>
<Literal>
<ID>ParentType</ID>
<Default>parentType</Default>
<ToolTip>Replace with property‘s parent type.</ToolTip>
</Literal>
</Declarations>
<Code Language="CSharp">
<![CDATA[
#region $PropertyName$
public static readonly DependencyProperty $PropertyName$Property =
DependencyProperty.Register("$PropertyName$", typeof ($PropertyType$), typeof ($ParentType$), new PropertyMetadata(
(sender, e) =>
{
}));
public $PropertyType$ $PropertyName$
{
get { return ($PropertyType$) GetValue($PropertyName$Property); }
set { SetValue($PropertyName$Property, value); }
}
#endregion
]]>
</Code>
</Snippet>
</CodeSnippet>

标签:
原文地址:http://www.cnblogs.com/weiweiboqi/p/4535439.html