Created
April 7, 2021 03:34
-
-
Save PieroCastillo/0f3d7a294f7f943e341ae8c17919243d to your computer and use it in GitHub Desktop.
Avalonia Styled Property Snippet for VisualStudio
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> | |
<Title>Define an StyledProperty</Title> | |
<Shortcut>styledprop</Shortcut> | |
<Description>Code snippet for a property using DependencyProperty as the backing store</Description> | |
<Author>Piero Castillo</Author> | |
<SnippetTypes> | |
<SnippetType>Expansion</SnippetType> | |
</SnippetTypes> | |
</Header> | |
<Snippet> | |
<Declarations> | |
<Literal> | |
<ID>type</ID> | |
<ToolTip>Property Type</ToolTip> | |
<Default>object</Default> | |
</Literal> | |
<Literal> | |
<ID>property</ID> | |
<ToolTip>Property Name</ToolTip> | |
<Default>MyProperty</Default> | |
</Literal> | |
<Literal> | |
<ID>ownerclass</ID> | |
<ToolTip>The owning class of this Property. Typically the class that it is declared in.</ToolTip> | |
<Default>ownerclass</Default> | |
</Literal> | |
</Declarations> | |
<Code Language="csharp"> | |
<![CDATA[ | |
public $type$ $property$ | |
{ | |
get => GetValue($property$Property); | |
set => SetValue($property$Property, value); | |
} | |
public static readonly StyledProperty<$type$> $property$Property = | |
AvaloniaProperty.Register<$ownerclass$,$type$>(nameof($property$)); | |
$end$]]> | |
</Code> | |
</Snippet> | |
</CodeSnippet> | |
</CodeSnippets> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment