Last active
June 1, 2017 05:13
-
-
Save syaifulnizamyahya/4cf5718ccd753ecb8be9d6fbe61a5fae to your computer and use it in GitHub Desktop.
MvvmCross Code Snippet for Visual Studio
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> | |
| <Title>MvvmCross async command</Title> | |
| <Description>MvvmCross async command</Description> | |
| <Shortcut>acmvx</Shortcut> | |
| <Author>Syaiful Nizam Yahya (based on Mikkel Jensen)</Author> | |
| <HelpUrl>http://stackoverflow.com/questions/18200679/mvvmcross-code-snippets-for-visual-studio</HelpUrl> | |
| </Header> | |
| <Snippet> | |
| <Declarations> | |
| <Literal> | |
| <ID>CommandName</ID> | |
| <ToolTip>Command name</ToolTip> | |
| <Default>ElementCommand</Default> | |
| </Literal> | |
| </Declarations> | |
| <Code Language="CSharp"> | |
| <![CDATA[ | |
| private MvxAsyncCommand _$CommandName$CommandAsync; | |
| public MvxAsyncCommand $CommandName$CommandAsync | |
| { | |
| get | |
| { | |
| _$CommandName$CommandAsync = _$CommandName$CommandAsync ?? new MvxAsyncCommand(Do$CommandName$CommandAsync); | |
| return _$CommandName$CommandAsync; | |
| } | |
| } | |
| private void Do$CommandName$CommandAsync() | |
| { | |
| $end$ | |
| } | |
| ]]> | |
| </Code> | |
| </Snippet> | |
| </CodeSnippet> | |
| </CodeSnippets> |
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> | |
| <Title>MvvmCross command</Title> | |
| <Author>Syaiful Nizam Yahya (forked from robertbaker)</Author> | |
| <Shortcut>cmvx</Shortcut> | |
| <Description>MvvmCross command</Description> | |
| </Header> | |
| <Snippet> | |
| <Declarations> | |
| <Literal> | |
| <ID>CommandName</ID> | |
| <ToolTip>Command name</ToolTip> | |
| <Default>ElementCommand</Default> | |
| </Literal> | |
| </Declarations> | |
| <Code Language="csharp"><![CDATA[ | |
| MvxCommand _$CommandName$; | |
| public System.Windows.Input.ICommand $CommandName$ | |
| { | |
| get | |
| { | |
| _$CommandName$ = _$CommandName$ ?? new MvxCommand(Do$CommandName$); | |
| return _$CommandName$; | |
| } | |
| } | |
| private void Do$CommandName$ () | |
| { | |
| $end$ | |
| } | |
| ]]> | |
| </Code> | |
| </Snippet> | |
| </CodeSnippet> | |
| </CodeSnippets> |
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> | |
| <Title>MvvmCross property</Title> | |
| <Author>Syaiful Nizam Yahya (forked from robertbaker)</Author> | |
| <Shortcut>pmvx</Shortcut> | |
| <Description>MvvmCross property</Description> | |
| <HelpUrl>https://gist.github.com/syaifulnizamyahya/4cf5718ccd753ecb8be9d6fbe61a5fae</HelpUrl> | |
| </Header> | |
| <Snippet> | |
| <Declarations> | |
| <Literal> | |
| <ID>type</ID> | |
| <ToolTip>Type of the property</ToolTip> | |
| <Default>string</Default> | |
| </Literal> | |
| <Literal> | |
| <ID>propertyName</ID> | |
| <ToolTip>Property name</ToolTip> | |
| <Default>Property</Default> | |
| </Literal> | |
| </Declarations> | |
| <Code Language="csharp"><![CDATA[ | |
| private $type$ _$propertyName$; | |
| public $type$ $propertyName$ | |
| { | |
| get | |
| { | |
| return _$propertyName$; | |
| } | |
| set | |
| { | |
| _$propertyName$ = value; | |
| RaisePropertyChanged (() => $propertyName$); | |
| } | |
| } | |
| $end$ | |
| ]]> | |
| </Code> | |
| </Snippet> | |
| </CodeSnippet> | |
| </CodeSnippets> |
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> | |
| <Title>MvvmCross binding set</Title> | |
| <Description>MvvmCross binding set</Description> | |
| <Shortcut>smvx</Shortcut> | |
| <Author>Syaiful Nizam Yahya (based on Mikkel Jensen)</Author> | |
| <HelpUrl>http://stackoverflow.com/questions/18200679/mvvmcross-code-snippets-for-visual-studio</HelpUrl> | |
| </Header> | |
| <Snippet> | |
| <Declarations> | |
| <Literal> | |
| <ID>viewName</ID> | |
| <ToolTip/> | |
| <Default>ViewName</Default> | |
| </Literal> | |
| <Literal> | |
| <ID>element</ID> | |
| <ToolTip/> | |
| <Default>Element</Default> | |
| </Literal> | |
| </Declarations> | |
| <Code Language="CSharp"> | |
| <![CDATA[ | |
| var set = this.CreateBindingSet<$viewName$View, $viewName$ViewModel>(); | |
| set.Bind($element$).To(vm => vm$end$); | |
| set.Apply(); | |
| ]]> | |
| </Code> | |
| </Snippet> | |
| </CodeSnippet> | |
| </CodeSnippets> |
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> | |
| <Title>MvvmCross viewmodel setup for x:bind</Title> | |
| <Description>MvvmCross viewmodel setup for x:bind</Description> | |
| <Shortcut>vmmvx</Shortcut> | |
| <Author>Syaiful Nizam Yahya</Author> | |
| <HelpUrl>https://stackoverflow.com/questions/34357545/using-xbind-with-mvvmcross</HelpUrl> | |
| </Header> | |
| <Snippet> | |
| <Declarations> | |
| <Literal> | |
| <ID>viewName</ID> | |
| <ToolTip/> | |
| <Default>ViewName</Default> | |
| </Literal> | |
| <Literal> | |
| <ID>element</ID> | |
| <ToolTip/> | |
| <Default>Element</Default> | |
| </Literal> | |
| </Declarations> | |
| <Code Language="CSharp"> | |
| <![CDATA[ | |
| public $viewName$ViewModel ViewModels => ($viewName$ViewModel)ViewModel; | |
| $end$ | |
| ]]> | |
| </Code> | |
| </Snippet> | |
| </CodeSnippet> | |
| </CodeSnippets> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment