Search code examples
mvvmcross

MVVMCross Code Snippets for Visual Studio?


where can I download the snippets for Visual Studio, the likes pf pmvx, cmvx and others? I though those would be available on the github projects, but can't find them...


Solution

  • I've already created my own. Please remember that these are ReSharper's template.

    mvxcom -> for Command

    #region $region$ command
    private MvxCommand _$NAME$Command;
    
    public ICommand $PNAME$Command
    {
        get
        {
           _$NAME$Command = _$NAME$Command ?? new MvxCommand(Do$PNAME$Command);
           return _$NAME$Command;
        }
    }
    
    private void Do$PNAME$Command()
    {
        $END$        
    }
    #endregion
    

    mvxprop -> for Properties

    #region $region$
    private $TYPE$ _$NAME$;
    public $TYPE$ $PNAME$
    { 
    get { return _$NAME$; }
    set { _$NAME$ = value; RaisePropertyChanged(() => $PNAME$); }
    }
    #endregion
    $END$
    

    mvxset -> Binding Set

    var set = this.CreateBindingSet<$VIEW$, $VIEW$Model>();
    set.Bind($ELEMENT$).To(vm => vm$END$);
    set.Apply();
    

    You can add them to your ReSharper using ReSharper>Template Explorer>Live Templates>New Template.

    Please feel free to change them however you desire.