-
-
Save KristofferBerge/abea88eda7f0d28d9b1e88bf5446033e to your computer and use it in GitHub Desktop.
Bindable Property Snippet for Xamarin Forms.
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>bpropc</Title> | |
<Author>Microsoft Corporation</Author> | |
<Description>Code snippet for an automatically implemented $name$Property | |
Language Version: C# 3.0 or higher</Description> | |
<HelpUrl> | |
</HelpUrl> | |
<Shortcut>bpropc</Shortcut> | |
</Header> | |
<Snippet> | |
<Declarations> | |
<Literal Editable="true"> | |
<ID>name</ID> | |
<ToolTip>name</ToolTip> | |
<Default>name</Default> | |
<Function> | |
</Function> | |
</Literal> | |
<Literal Editable="true"> | |
<ID>owner</ID> | |
<ToolTip>owner</ToolTip> | |
<Default>Owner</Default> | |
<Function> | |
</Function> | |
</Literal> | |
<Literal Editable="true"> | |
<ID>type</ID> | |
<ToolTip>type</ToolTip> | |
<Default>Type</Default> | |
<Function> | |
</Function> | |
</Literal> | |
</Declarations> | |
<Code Language="csharp"><![CDATA[public static readonly BindableProperty $name$Property = BindableProperty.Create( | |
propertyName: "$name$", | |
returnType: typeof($type$), | |
declaringType: typeof($owner$), | |
defaultValue: default($type$), | |
propertyChanged: On$name$Changed | |
); | |
public $type$ $name$ | |
{ | |
get { return ($type$)GetValue($name$Property); } | |
set { SetValue($name$Property, value); } | |
} | |
private static void On$name$Changed(BindableObject bindable, object oldValue, object newValue){ | |
throw new NotImplementedException(); | |
} | |
$end$]]></Code> | |
</Snippet> | |
</CodeSnippet> | |
</CodeSnippets> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment