Last active
January 23, 2017 09:25
-
-
Save xeterixon/d1b33a3d5c6b40be8562 to your computer and use it in GitHub Desktop.
Xamarin Studio Code Snippet for creating the boilerplate code of a bindable property.
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
<!-- | |
Download and copy this file to ~/Library/XamarinStudio-VERSION/Snippets | |
In a .cs file, type "bprop" and TAB to insert the code for a bindable property | |
--> | |
<?xml version="1.0" encoding="utf-8"?> | |
<CodeTemplates version="3.0"> | |
<CodeTemplate version="2.0"> | |
<Header> | |
<_Group>C#</_Group> | |
<Version /> | |
<MimeType>text/x-csharp</MimeType> | |
<Shortcut>bprop</Shortcut> | |
<_Description>Bindable Property</_Description> | |
<TemplateType>Unknown</TemplateType> | |
</Header> | |
<Variables> | |
<Variable name="name"> | |
<Default>PropertyName</Default> | |
</Variable> | |
<Variable name="type"> | |
<Default>PropertyType</Default> | |
</Variable> | |
<Variable name="class"> | |
<Default>Class</Default> | |
</Variable> | |
<Variable name="default"> | |
<Default>DefaultValue</Default> | |
</Variable> | |
</Variables> | |
<Code><![CDATA[public static readonly BindableProperty $name$Property = BindableProperty.Create(nameof($name$),typeof($type$),typeof($class$),$default$); | |
public $type$ $name$ | |
{ | |
get{return ($type$)GetValue($name$Property);} | |
set{ SetValue( $name$Property, value);} | |
} | |
]]></Code> | |
</CodeTemplate> | |
</CodeTemplates> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It actually works better if$type$ $name$ ...
public
comes before
public static readonly BindableProperty $name$Property