Last active
October 2, 2022 15:16
-
-
Save JamestsaiTW/3e51d9d07d8d1d67e75702db55abcd8b to your computer and use it in GitHub Desktop.
針對 CommunityToolkit.Mvvm 套件設計運用
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> | |
<Title>nprop</Title> | |
<Shortcut>nprop</Shortcut> | |
<Description>使用 CommunityToolkit.Mvvm.ComponentModel 設計支援屬性和欄位程式碼片段</Description> | |
<Author>James Tsai</Author> | |
<SnippetTypes> | |
<SnippetType>Expansion</SnippetType> | |
</SnippetTypes> | |
</Header> | |
<Snippet> | |
<Declarations> | |
<Literal> | |
<ID>field</ID> | |
<ToolTip>欄位名稱</ToolTip> | |
<Default>myField</Default> | |
</Literal> | |
<Literal> | |
<ID>type</ID> | |
<ToolTip>屬性類型</ToolTip> | |
<Default>int</Default> | |
</Literal> | |
<Literal> | |
<ID>property</ID> | |
<ToolTip>屬性名稱</ToolTip> | |
<Default>MyProperty</Default> | |
</Literal> | |
</Declarations> | |
<Code Language="csharp"><![CDATA[private $type$ _$field$; | |
public $type$ $property$ | |
{ | |
get { return _$field$;} | |
set { SetProperty<$type$>(ref _$field$, value );} | |
} | |
$end$]]> | |
</Code> | |
</Snippet> | |
</CodeSnippet> | |
</CodeSnippets> |
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> | |
<Title>實作 ICommand 程式碼片段</Title> | |
<Shortcut>swicmd</Shortcut> | |
<Description>針對使用 System.Windows.Input 設計繫結命令進行實作 ICommand 的程式碼片段</Description> | |
<Author>James Tsai</Author> | |
<SnippetTypes> | |
<SnippetType>Expansion</SnippetType> | |
</SnippetTypes> | |
</Header> | |
<Snippet> | |
<Declarations> | |
<Literal> | |
<ID>name</ID> | |
<ToolTip>Command 命名名稱</ToolTip> | |
<Default>MyNew</Default> | |
</Literal> | |
</Declarations> | |
<Code Language="csharp"><![CDATA[ | |
public ICommand $name$Command | |
{ | |
get | |
{ | |
return new Command(() => | |
{ | |
$end$ | |
}); | |
} | |
} | |
]]> | |
</Code> | |
</Snippet> | |
</CodeSnippet> | |
</CodeSnippets> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment