Skip to content

Instantly share code, notes, and snippets.

@tuyen-vuduc
Created November 12, 2017 15:30
Show Gist options
  • Save tuyen-vuduc/0302efcbecde33a7fd99c57835db789b to your computer and use it in GitHub Desktop.
Save tuyen-vuduc/0302efcbecde33a7fd99c57835db789b to your computer and use it in GitHub Desktop.
MVVM - C# Snippets (Visual Studio for Mac)
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); }
}
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) {}
$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