{"id":19140936,"url":"https://github.com/theeightbot/visualstudioformacsnippets","last_synced_at":"2025-07-09T17:06:11.164Z","repository":{"id":83525094,"uuid":"100630203","full_name":"TheEightBot/VisualStudioForMacSnippets","owner":"TheEightBot","description":"Snippets for Visual Studio for Mac","archived":false,"fork":false,"pushed_at":"2023-08-27T04:30:40.000Z","size":8678,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-07-09T17:06:05.782Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheEightBot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-08-17T17:47:41.000Z","updated_at":"2022-04-02T16:55:22.000Z","dependencies_parsed_at":"2023-03-12T18:41:16.113Z","dependency_job_id":"b66ac392-04d8-4b85-a4ac-b92e43ebc321","html_url":"https://github.com/TheEightBot/VisualStudioForMacSnippets","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TheEightBot/VisualStudioForMacSnippets","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheEightBot%2FVisualStudioForMacSnippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheEightBot%2FVisualStudioForMacSnippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheEightBot%2FVisualStudioForMacSnippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheEightBot%2FVisualStudioForMacSnippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheEightBot","download_url":"https://codeload.github.com/TheEightBot/VisualStudioForMacSnippets/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheEightBot%2FVisualStudioForMacSnippets/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264502127,"owners_count":23618554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T07:19:29.154Z","updated_at":"2025-07-09T17:06:11.129Z","avatar_url":"https://github.com/TheEightBot.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"## ReactiveUI / Xamarin Snippets\n\nAdd these snippets to **~/Library/VisualStudio/7.0/Snippets**\n\n### wav \n\n```\nthis.WhenAnyValue(x =\u003e x.ViewModel.$Property$)\n    .Subscribe($local$ =\u003e { })\n    .DisposeWith($Bindings$);\n```\n \n### wao  \n\n```\nthis.WhenAnyObservable(x =\u003e x.ViewModel.$SomeCommand$)\n    .ObserveOn(RxApp.MainThreadScheduler)\n    .Subscribe(val =\u003e { \n         System.Diagnostics.Debug.WriteLine(\"{0}\", val);\n    })\n    .DisposeWith($ControlBindings$);\n```\n\n### bindc\n\n ```\nthis.BindCommand(ViewModel, x =\u003e x.$Command$, c =\u003e c._$control$)\n    .DisposeWith(ControlBindings);\n```\n\n### bindone\n\n```\nthis.OneWayBind(ViewModel, x =\u003e x.$Property$, c =\u003e c._$controlName$)\n    .DisposeWith(ControlBindings);\n```\n\n### bindvm\n\n```\nthis.Bind(ViewModel, x =\u003e x.$Property$, c =\u003e c._$controlName$)\n    .DisposeWith(ControlBindings);\n```\n\n### bindpicker\n\n```\nthis._$myPicker$.Picker\n    .Bind(\n        this.WhenAnyValue(x =\u003e x.ViewModel.$Collection$),\n            x =\u003e ViewModel.$SomeId$ = x.$SomeId2$,\n            x =\u003e ViewModel.$SomeId$ == x.$SomeId2$,\n            x =\u003e x.$SomeLabel$)\n    .DisposeWith(ControlBindings);\n```\n\n### bindlist\n\n```\nthis.$_myList$.Bind(this.WhenAnyValue(x =\u003e x.ViewModel.Data))\n    .DisposeWith(ControlBindings);\n\nthis.$_myList$\n    .ListViewItemTapped\n    .Subscribe(selected =\u003e\n    {\n        $_myList$.SelectedItem = null;\n    })\n    .DisposeWith(ControlBindings);\n```\n\n### combine\n\n```\nObservable\n    .CombineLatest(\n        this.WhenAnyValue(x =\u003e x.ViewModel.$Prop1$),\n        this.WhenAnyValue(x =\u003e x.ViewModel.$Prop2$), \n            ($val1$, $val2$) =\u003e string.Format(\"{0}, {1}\", $val1$, $val2$))\n    .BindTo(_$control$, c =\u003e c.Text)\n    .DisposeWith(ControlBindings);\n```\n\n\n### merge\n\n```\nObservable\n    .Merge(\n        this.WhenAnyObservable(x =\u003e x.ViewModel.NavigateTo),\n        this.WhenAnyObservable(x =\u003e x.ViewModel.NavigateTo))\n    .Subscribe(val =\u003e\n    {\n\n    }) \n    .DisposeWith($Bindings$);\n```\n\n### rc\n\n```\n  ReactiveCommand\u003cUnit\u003e _$myCommand$;\n  [DataMember]\n  public ReactiveCommand\u003cUnit\u003e $MyCommand$\n  {\n      get { return _$myCommand$; }\n      private set\n      {\n          this.RaiseAndSetIfChanged(ref _$myCommand$, value);\n      }\n  }\n```\n\n### rcmd\n\n```\n$CommandName$ =\n    ReactiveCommand\n        .CreateAsyncTask(_ =\u003e\n        { \n            return Task.FromResult(Unit.Default);\n        })\n        .DisposeWith(ViewModelBindings);\n```\n\n### rtrig\n\n```$SomeCommand$ = ReactiveCommand.Create().DisposeWith(ViewModelBindings);```\n\n### propbind\n\n```\npublic static BindableProperty $Some$Property =\n    BindableProperty.Create(nameof($Some$), typeof($SomeType$), typeof($SomeClass$), default($SomeType$),\n                            propertyChanged: (bindable, oldValue, newValue) =\u003e (bindable as $SomeClass$)?.InvalidateSurface());\n\n  public $SomeType$ $Some$\n  {\n      get { return ($SomeType$)GetValue($Some$Property); }\n      set { SetValue($Some$Property, value); }\n  } \n```\n\n### classvm\n\n```\npublic class $Name$ : ViewModelBase\u003c$Name$\u003e \n{\n//using System;\n//using System.Reactive;\n//using System.Reactive.Linq;\n//using System.Runtime.Serialization;\n//using System.Threading.Tasks;\n//using EightBot.BigBang.Extensions;\n//using EightBot.BigBang.ViewModel;\n//using FluentValidation;\n//using ReactiveUI;\n//using Splat;\n\n    public override string Title\n    {\n        get { return string.Empty; }\n    }\n\n    public override AbstractValidator\u003c$Name$\u003e Validator =\u003e null;\n \n    public $Name$() {}\n\n    protected override void Initialize()\n    {\n         base.Initialize();\n    }\n\n    ReactiveCommand\u003cUnit\u003e _initializeData;\n    [DataMember]\n    public ReactiveCommand\u003cUnit\u003e InitializeData\n    {\n        get { return _initializeData; }\n        private set\n        {\n            this.RaiseAndSetIfChanged(ref _initializeData, value);\n        }\n    } \n\n    protected override void RegisterObservables()\n    {\n        InitializeData =\n            ReactiveCommand\n                .CreateAsyncTask(_ =\u003e {\n                         \n                    return System.Threading.Tasks.Task.FromResult(Unit.Default);\n                })\n                .DisposeWith(ViewModelBindings);\n\n        /* Navigation Commands *****/\n \n\n        /* Validation *****/\n\n\n        /* Observables *****/\n    }\n\n}\n```\n\n### classui\n\n```\npublic class $Name$ : ContentPageBase\u003cViewModels.$Name$\u003e\n{ \n//using System;\n//using System.Reactive.Linq;\n//using EightBot.BigBang.Extensions;\n//using EightBot.BigBang.XamForms.Extensions;\n//using EightBot.BigBang.XamForms.Pages;\n//using EightBot.BigBang.XamForms.Views;\n//using ReactiveUI;\n//using Xamarin.Forms;\n\n    Grid _mainLayout;\n\n    public $Name$()\n    {\n        ViewModel = new ViewModels.$Name$();\n    } \n\n    protected override void SetupUserInterface()\n    {   \n          _mainLayout = new Grid\n          {\n                BackgroundColor = Color.Transparent,\n                HorizontalOptions = LayoutOptions.FillAndExpand,\n                VerticalOptions = LayoutOptions.FillAndExpand,\n                Margin = new Thickness(Values.Layout.Padding, Values.Layout.TriplePadding, Values.Layout.Padding, Values.Layout.Padding),\n                ColumnSpacing = Values.Layout.Padding,\n                RowSpacing = Values.Layout.HalfPadding,\n                ColumnDefinitions = new ColumnDefinitionCollection { \n                    new ColumnDefinition { Width = GridLength.Star },\n                },\n                RowDefinitions = new RowDefinitionCollection {\n                    new RowDefinition { Height = GridLength.Star },\n                    new RowDefinition { Height = GridLength.Star }\n                }\n            };\n\n        Content = _mainLayout;\n    }\n\n    protected override void BindControls()\n    {  \n        this.OneWayBind(ViewModel, x =\u003e x.Title, c =\u003e c.Title)\n            .DisposeWith(ControlBindings);\n \n        this.WhenAnyValue(x =\u003e x.ViewModel)\n            .IsNotNull()\n            .InvokeCommand(this, x =\u003e x.ViewModel.InitializeData)\n            .DisposeWith(ControlBindings);\n    }\n}\n```\n\n### classcell\n\n```\npublic class $Name$Cell : ReactiveViewCell\u003cViewModels.$Name$Item\u003e\n{ \n//using System;\n//using System.Linq;\n//using EightBot.BigBang.Extensions;\n//using EightBot.BigBang.XamForms.Pages;\n//using EightBot.BigBang.XamForms.Views;\n//using ReactiveUI;\n//using ReactiveUI.XamForms;\n//using Xamarin.Forms;\n\n    public const int RequestedHeight = Values.Layout.StandardCellHeight;\n\n    Grid _mainLayout;\n\n    public $Name$Cell()\n    {\n        ViewModel = new ViewModels.$Name$Item();\n    } \n\n    protected override void SetupUserInterface()\n    {   \n         _mainLayout = new Grid\n            {\n                BackgroundColor = Color.Transparent,\n                HorizontalOptions = LayoutOptions.FillAndExpand,\n                VerticalOptions = LayoutOptions.FillAndExpand, \n                RowSpacing = Values.Layout.HalfPadding,\n                ColumnDefinitions = new ColumnDefinitionCollection {\n                        new ColumnDefinition { Width = GridLength.Star },\n                    },\n                RowDefinitions = new RowDefinitionCollection {\n                        new RowDefinition { Height = GridLength.Star },\n                        new RowDefinition { Height = GridLength.Star }\n                    }\n            };\n\n            View = _mainLayout;\n    }\n\n    protected override void BindControls()\n    {  \n        this.WhenAnyValue(x =\u003e x.ViewModel)\n            .IsNotNull()\n            .InvokeCommand(this, x =\u003e x.ViewModel.InitializeData);\n    }\n}\n```\n\n### dw\n\n```System.Diagnostics.Debug.WriteLine($\"{val}\");```\n\n### layopt\n\n```\nHorizontalOptions = LayoutOptions.FillAndExpand,\nVerticalOptions = LayoutOptions.FillAndExpand,\n```\n\n### locate\n\n```var repo = Locator.CurrentMutable.GetService\u003c$SomeService$\u003e();```\n\n### grid\n\n```\n_mainLayout = new Grid()\n{\n    ColumnDefinitions = new ColumnDefinitionCollection()\n    {\n        new ColumnDefinition() { Width = GridLength.Star }\n    },\n    RowDefinitions = new RowDefinitionCollection()\n    {\n        new RowDefinition() { Height = GridLength.Star },\n    }\n};\n```\n\n### label\n\n```\n_$myLabel$ = new Label\n{ \n      Style = Values.Theme.LabelStyle,\n      HorizontalOptions = LayoutOptions.FillAndExpand,\n      VerticalOptions = LayoutOptions.CenterAndExpand\n  };\n```\n\n### taskr\n\n```await Task.Run(()=\u003e { });```\n\n### stopwatch\n\n```\nvar stopWatch = new System.Diagnostics.Stopwatch();\nstopWatch.Start();\nstopWatch.Stop();\nSystem.Diagnostics.Debug.WriteLine($\"stopWatch time : {stopWatch.Elapsed}\");\n```\n\n### retdef\n\n```return Task.FromResult(Unit.Default);```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheeightbot%2Fvisualstudioformacsnippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheeightbot%2Fvisualstudioformacsnippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheeightbot%2Fvisualstudioformacsnippets/lists"}