Created
August 1, 2020 12:49
-
-
Save dfkeenan/1a0398415e59f269ad1cd0bb6c44d7e8 to your computer and use it in GitHub Desktop.
AvaloniaUI Snippets
This file contains hidden or 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>AvaloniaUIDirectProperty</Title> | |
| <Author> | |
| </Author> | |
| <Description> | |
| </Description> | |
| <HelpUrl> | |
| </HelpUrl> | |
| <Shortcut>avdp</Shortcut> | |
| </Header> | |
| <Snippet> | |
| <Declarations> | |
| <Literal Editable="true"> | |
| <ID>Type</ID> | |
| <ToolTip>Property Type</ToolTip> | |
| <Default>string</Default> | |
| <Function> | |
| </Function> | |
| </Literal> | |
| <Literal Editable="true"> | |
| <ID>Name</ID> | |
| <ToolTip>Property name</ToolTip> | |
| <Default>MyProperty</Default> | |
| <Function> | |
| </Function> | |
| </Literal> | |
| <Literal Editable="true"> | |
| <ID>Field</ID> | |
| <ToolTip>Field name</ToolTip> | |
| <Default>myProperty</Default> | |
| <Function> | |
| </Function> | |
| </Literal> | |
| <Literal Editable="true"> | |
| <ID>Control</ID> | |
| <ToolTip>Control name</ToolTip> | |
| <Function>ClassName()</Function> | |
| <Default>ClassNamePlaceholder</Default> | |
| </Literal> | |
| <Literal Editable="true"> | |
| <ID>Default</ID> | |
| <ToolTip>Default value</ToolTip> | |
| <Default>null</Default> | |
| <Function> | |
| </Function> | |
| </Literal> | |
| </Declarations> | |
| <Imports> | |
| <Import> | |
| <Namespace>Avalonia</Namespace> | |
| </Import> | |
| </Imports> | |
| <Code Language="csharp" Delimiter="$"><![CDATA[public static readonly DirectProperty<$Control$, $Type$> $Name$Property | |
| = AvaloniaProperty.RegisterDirect<$Control$, $Type$>(nameof($Name$), o => o.$Name$, (o, v) => o.$Name$ = v); | |
| private $Type$ $Field$ = $Default$; | |
| public $Type$ $Name$ | |
| { | |
| get => $Field$; | |
| set => SetAndRaise($Name$Property, ref $Field$, value); | |
| }]]></Code> | |
| </Snippet> | |
| </CodeSnippet> | |
| </CodeSnippets> |
This file contains hidden or 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>AvaloniaUIDirectPropertyReadOnly</Title> | |
| <Author> | |
| </Author> | |
| <Description> | |
| </Description> | |
| <HelpUrl> | |
| </HelpUrl> | |
| <Shortcut>avdpg</Shortcut> | |
| </Header> | |
| <Snippet> | |
| <Declarations> | |
| <Literal Editable="true"> | |
| <ID>Control</ID> | |
| <ToolTip>Control namae</ToolTip> | |
| <Function>ClassName()</Function> | |
| <Default>ClassNamePlaceholder</Default> | |
| </Literal> | |
| <Literal Editable="true"> | |
| <ID>Name</ID> | |
| <ToolTip>Property name</ToolTip> | |
| <Default>MyProperty</Default> | |
| <Function> | |
| </Function> | |
| </Literal> | |
| <Literal Editable="true"> | |
| <ID>Type</ID> | |
| <ToolTip>Property Type</ToolTip> | |
| <Default>string</Default> | |
| <Function> | |
| </Function> | |
| </Literal> | |
| <Literal Editable="true"> | |
| <ID>Field</ID> | |
| <ToolTip>Field name</ToolTip> | |
| <Default>myField</Default> | |
| <Function> | |
| </Function> | |
| </Literal> | |
| <Literal Editable="true"> | |
| <ID>Default</ID> | |
| <ToolTip>Default value</ToolTip> | |
| <Default>null</Default> | |
| <Function> | |
| </Function> | |
| </Literal> | |
| </Declarations> | |
| <Imports> | |
| <Import> | |
| <Namespace>Avalonia</Namespace> | |
| </Import> | |
| </Imports> | |
| <Code Language="csharp" Delimiter="$"><![CDATA[public static readonly DirectProperty<$Control$, $Type$> $Name$Property | |
| = AvaloniaProperty.RegisterDirect<$Control$, $Type$>(nameof($Name$), o => o.$Name$); | |
| private $Type$ $Field$ = $Default$; | |
| public $Type$ $Name$ | |
| { | |
| get { return $Field$; } | |
| } | |
| ]]></Code> | |
| </Snippet> | |
| </CodeSnippet> | |
| </CodeSnippets> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment