Created
November 12, 2017 15:30
-
-
Save tuyen-vuduc/0302efcbecde33a7fd99c57835db789b to your computer and use it in GitHub Desktop.
MVVM - C# Snippets (Visual Studio for Mac)
This file contains 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
public static readonly BindableProperty $Name$Property = BindableProperty.Create( | |
nameof($Name$), | |
typeof($Type$), | |
typeof($Class$), | |
default($Type$), | |
BindingMode.$Mode$); | |
public $Type$ $Name$ | |
{ | |
get { return ($Type$)GetValue($Name$Property); } | |
set { SetValue($Name$Property, value); } | |
} |
This file contains 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
ICommand _$name$Command; | |
public ICommand $name$Command | |
{ | |
get { return (_$name$Command = _$name$Command ?? new Command<$type$>(Execute$name$Command, CanExecute$name$Command)); } | |
} | |
bool CanExecute$name$Command($type$ obj) { return true; } | |
void Execute$name$Command($type$ obj) {} |
This file contains 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
$type$ _$name$; | |
public $type$ $name$ | |
{ | |
get => _$name$; | |
set => SetProperty(ref _$name$, value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment