Skip to content

Instantly share code, notes, and snippets.

@philcleveland
Last active June 28, 2016 23:05
Show Gist options
  • Save philcleveland/7435255 to your computer and use it in GitHub Desktop.
Save philcleveland/7435255 to your computer and use it in GitHub Desktop.
RxUI VS snippets
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>RxCommand</Title>
<Shortcut>rxcmd</Shortcut>
<Description>Code snippet for a ReactiveUI Command</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>type</ID>
<ToolTip>Command type</ToolTip>
<Default>object</Default>
</Literal>
<Literal>
<ID>command</ID>
<ToolTip>Command name</ToolTip>
<Default>DoSomething</Default>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[public ReactiveCommand<$type$> $command$ { get; private set; }$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>IViewFor<T></Title>
<Shortcut>rx_iv4</Shortcut>
<Description>Generates the dependency prop for IViewFor</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>classname</ID>
<ToolTip>View type</ToolTip>
<Function>ClassName()</Function>
<Default>ClassNamePlaceholder</Default>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[public static readonly DependencyProperty ViewModelProperty =
DependencyProperty.Register("ViewModel", typeof($classname$Model), typeof($classname$), new PropertyMetadata(null));
public $classname$Model ViewModel
{
get { return ($classname$Model)GetValue(ViewModelProperty); }
set { SetValue(ViewModelProperty, value); }
}
object IViewFor.ViewModel
{
get { return ViewModel; }
set { ViewModel = ($classname$Model)value; }
}$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Rx ObservableAsPropertyHelper</Title>
<Shortcut>rxOAPH</Shortcut>
<Description>Code snippet for a ReactiveUI ObservableAsPropertyHelper</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>type</ID>
<ToolTip>Property type</ToolTip>
<Default>int</Default>
</Literal>
<Literal>
<ID>property</ID>
<ToolTip>Property name</ToolTip>
<Default>MyProperty</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[private ObservableAsPropertyHelper<$type$> _$property$;
public $type$ $property$
{
get {return _$property$.Value;}
}$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>RxProp</Title>
<Shortcut>rxprop</Shortcut>
<Description>Code snippet for a Reactive property</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>type</ID>
<ToolTip>Property type</ToolTip>
<Default>int</Default>
</Literal>
<Literal>
<ID>property</ID>
<ToolTip>Property name</ToolTip>
<Default>MyProperty</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[private $type$ _$property$;
public $type$ $property$
{
get {return _$property$;}
set { this.RaiseAndSetIfChanged(ref _$property$, value); }
}$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Rx View Registration</Title>
<Shortcut>rxreg</Shortcut>
<Description>Code snippet for a ReactiveUI View Registration</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>viewType</ID>
<ToolTip>View Name</ToolTip>
<Default>My</Default>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[Locator.CurrentMutable.Register(() => new $viewType$View(), typeof(IViewFor<$viewType$ViewModel>));$end$]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment