Blog: Pro Tip: Useful Code Snippets For Your Xamarin.Forms Development. IntelliAbb.com
<?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>bctor</Shortcut> | |
<_Description>Constructor with injections</_Description> | |
<TemplateType>Unknown</TemplateType> | |
</Header> | |
<Variables> | |
<Variable name="classname"> | |
<Default>notset</Default> | |
<_ToolTip>Class name</_ToolTip> | |
<Function>GetCurrentClassName()</Function> | |
</Variable> | |
<Variable name="modifier"> | |
<Default>notset</Default> | |
<Function>GetConstructorModifier()</Function> | |
</Variable> | |
</Variables> | |
<Code><![CDATA[$modifier$$classname$ (INavigationService navigationService) : base(navigationService) | |
{ | |
$end$ | |
}]]></Code> | |
</CodeTemplate> | |
</CodeTemplates> |
<?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 Template</_Description> | |
<TemplateType>Unknown</TemplateType> | |
</Header> | |
<Variables> | |
<Variable name="modifier"> | |
<Default>notset</Default> | |
<Function>GetClassModifier()</Function> | |
</Variable> | |
<Variable name="someproperty"> | |
<Default>SomeProperty</Default> | |
</Variable> | |
<Variable name="some"> | |
<Default>Some</Default> | |
</Variable> | |
<Variable name="type"> | |
<Default>object</Default> | |
</Variable> | |
<Variable name="classname" isEditable="false"> | |
<Default>notset</Default> | |
<Function>GetCurrentClassName()</Function> | |
</Variable> | |
</Variables> | |
<Code><![CDATA[public static BindableProperty $some$Property = BindableProperty.Create(nameof($some$), typeof($type$), typeof($classname$)); | |
public $type$ $some$ | |
{ | |
get { return ($type$) GetValue($some$Property); } | |
set { SetValue($some$Property, value); } | |
}$end$]]></Code> | |
</CodeTemplate> | |
</CodeTemplates> |
<?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>cmdg</Shortcut> | |
<_Description>Prism DelegateCommand Generic - Creates a generic DelegateCommand property.</_Description> | |
<TemplateType>Unknown</TemplateType> | |
</Header> | |
<Variables> | |
<Variable name="type"> | |
<Default>string</Default> | |
</Variable> | |
<Variable name="commandName"> | |
<Default>CommandName</Default> | |
</Variable> | |
</Variables> | |
<Code><![CDATA[public DelegateCommand<$type$> $commandName$ { get; } = new DelegateCommand<$type$>(On$commandName$Executed); | |
private void On$commandName$Executed($type$ item) | |
{ | |
}$end$]]></Code> | |
</CodeTemplate> | |
</CodeTemplates> |
<?xml version="1.0" encoding="utf-8"?> | |
<CodeTemplates version="3.0"> | |
<CodeTemplate version="2.0"> | |
<Header> | |
<_Group>Xml</_Group> | |
<Version /> | |
<MimeType>application/xml</MimeType> | |
<Shortcut>gcd</Shortcut> | |
<_Description>Grid Column Definitions Template</_Description> | |
<TemplateType>Unknown</TemplateType> | |
</Header> | |
<Variables /> | |
<Code><![CDATA[<Grid.ColumnDefinitions> | |
<ColumnDefinition Width="*"/> | |
<ColumnDefinition Width="*"/> | |
</Grid.ColumnDefinitions>]]></Code> | |
</CodeTemplate> | |
</CodeTemplates> |
<?xml version="1.0" encoding="utf-8"?> | |
<CodeTemplates version="3.0"> | |
<CodeTemplate version="2.0"> | |
<Header> | |
<_Group>Xml</_Group> | |
<Version /> | |
<MimeType>application/xml</MimeType> | |
<Shortcut>grd</Shortcut> | |
<_Description>Grid Row Definitions Template</_Description> | |
<TemplateType>Unknown</TemplateType> | |
</Header> | |
<Variables /> | |
<Code><![CDATA[<Grid.RowDefinitions> | |
<RowDefinition Height="Auto"/> | |
<RowDefinition Height="Auto"/> | |
</Grid.RowDefinitions>]]></Code> | |
</CodeTemplate> | |
</CodeTemplates> |
<?xml version="1.0" encoding="utf-8"?> | |
<CodeTemplates version="3.0"> | |
<CodeTemplate version="2.0"> | |
<Header> | |
<_Group>Xml</_Group> | |
<Version /> | |
<MimeType>application/xml</MimeType> | |
<Shortcut>grid</Shortcut> | |
<_Description>Grid Template</_Description> | |
<TemplateType>Expansion, SurroundsWith</TemplateType> | |
</Header> | |
<Variables /> | |
<Code><![CDATA[<Grid> | |
<Grid.RowDefinitions> | |
<RowDefinition Height="*"/> | |
<RowDefinition Height="*"/> | |
</Grid.RowDefinitions> | |
<Grid.ColumnDefinitions> | |
<ColumnDefinition Width="*"/> | |
<ColumnDefinition Width="*"/> | |
</Grid.ColumnDefinitions> | |
$selected$$end$ | |
</Grid>]]></Code> | |
</CodeTemplate> | |
</CodeTemplates> |
<?xml version="1.0" encoding="utf-8"?> | |
<CodeTemplates version="3.0"> | |
<CodeTemplate version="2.0"> | |
<Header> | |
<_Group>Xml</_Group> | |
<Version /> | |
<MimeType>application/xml</MimeType> | |
<Shortcut>rsd</Shortcut> | |
<_Description>Resource Dictionary Template</_Description> | |
<TemplateType>Expansion</TemplateType> | |
</Header> | |
<Variables> | |
<Variable name="type"> | |
<Default>Label</Default> | |
</Variable> | |
<Variable name="pName"> | |
<Default>TextColor</Default> | |
</Variable> | |
<Variable name="pValue"> | |
<Default>Blue</Default> | |
</Variable> | |
</Variables> | |
<Code><![CDATA[<ContentPage.Resources> | |
<ResourceDictionary> | |
<Style TargetType="$type$"> | |
<Setter Property="$pName$" Value="$pValue$"/> | |
</Style> | |
</ResourceDictionary> | |
</ContentPage.Resources>]]></Code> | |
</CodeTemplate> | |
</CodeTemplates> |
<?xml version="1.0" encoding="utf-8"?> | |
<CodeTemplates version="3.0"> | |
<CodeTemplate version="2.0"> | |
<Header> | |
<_Group>Xml</_Group> | |
<Version /> | |
<MimeType>application/xml</MimeType> | |
<Shortcut>stl</Shortcut> | |
<_Description>StackLayout Template</_Description> | |
<TemplateType>Expansion, SurroundsWith</TemplateType> | |
</Header> | |
<Variables /> | |
<Code><![CDATA[<StackLayout> | |
$selected$$end$ | |
</StackLayout>]]></Code> | |
</CodeTemplate> | |
</CodeTemplates> |
<?xml version="1.0" encoding="utf-8"?> | |
<CodeTemplates version="3.0"> | |
<CodeTemplate version="2.0"> | |
<Header> | |
<_Group>Xml</_Group> | |
<Version /> | |
<MimeType>application/xml</MimeType> | |
<Shortcut>tbi</Shortcut> | |
<_Description>Toolbar Items Template</_Description> | |
<TemplateType>Expansion</TemplateType> | |
</Header> | |
<Variables> | |
<Variable name="name"> | |
<Default>Item</Default> | |
</Variable> | |
<Variable name="icon"> | |
<Default>item.png</Default> | |
</Variable> | |
<Variable name="text"> | |
<Default>Hello</Default> | |
</Variable> | |
</Variables> | |
<Code><![CDATA[<ContentPage.ToolbarItems> | |
<ToolbarItem Name="$name$" Icon="$icon$" Text="$text$" Command="On$name$Tapped" />$end$ | |
</ContentPage.ToolbarItems>]]></Code> | |
</CodeTemplate> | |
</CodeTemplates> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment