Skip to content

Instantly share code, notes, and snippets.

@parth7676
Last active February 19, 2021 03:18
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save parth7676/b54883e14190e69557b64ee0f19fe5ce to your computer and use it in GitHub Desktop.
Save parth7676/b54883e14190e69557b64ee0f19fe5ce to your computer and use it in GitHub Desktop.
Bindable Property Snippet for Xamarin Forms.
<?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>bprop</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>bprop</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("$name$", typeof($type$), typeof($owner$),default($type$));
public $type$ $name$
{
get { return ($type$)GetValue($name$Property); }
set { SetValue($name$Property, value); }
}$end$]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
@Saccomani
Copy link

thnaks! 👍

@BrightSoul
Copy link

Great, thank you!

@vlkam
Copy link

vlkam commented Aug 18, 2017

Thank you!

@DamienDoumer
Copy link

Thanks, this is helpful

@Juansero29
Copy link

Great job :) I just did some modifications for it to be cleaner and enjoy new capabilities in new C# versions. You can see my fork here: https://gist.github.com/Juansero29/5c3b42be5ef26e6e1d61048863508efb

@kubaizi
Copy link

kubaizi commented Jun 24, 2019

very helpful, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment