{"id":18309176,"url":"https://github.com/catel/catel.templates","last_synced_at":"2026-03-08T11:35:28.197Z","repository":{"id":37820862,"uuid":"198989386","full_name":"Catel/Catel.Templates","owner":"Catel","description":"Item and project templates for Catel","archived":false,"fork":false,"pushed_at":"2025-03-31T07:07:20.000Z","size":22865,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-03-31T08:22:46.724Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Catel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/support.yml","governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["Catel","GeertvanHorrik"],"patreon":null,"open_collective":"Catel","ko_fi":null,"tidelift":null,"custom":null}},"created_at":"2019-07-26T09:34:34.000Z","updated_at":"2025-03-31T07:07:23.000Z","dependencies_parsed_at":"2024-03-06T11:53:02.711Z","dependency_job_id":"ae97dca8-bd69-49ca-a6c3-93df9c356096","html_url":"https://github.com/Catel/Catel.Templates","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Catel%2FCatel.Templates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Catel%2FCatel.Templates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Catel%2FCatel.Templates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Catel%2FCatel.Templates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Catel","download_url":"https://codeload.github.com/Catel/Catel.Templates/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247375195,"owners_count":20928970,"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-05T16:10:27.852Z","updated_at":"2025-10-08T10:15:48.606Z","avatar_url":"https://github.com/Catel.png","language":"C#","funding_links":["https://github.com/sponsors/Catel","https://github.com/sponsors/GeertvanHorrik","https://opencollective.com/Catel"],"categories":[],"sub_categories":[],"readme":"Catel.Templates\n===============\n\nThis repository contains the item and project templates for Catel.\n\nThe easiest way to get the code snippets is by installing them via the \u003ca href=\"https://marketplace.visualstudio.com/items?itemName=Catel.Catel-CodeSnippets\" target=\"_blank\"\u003eVisual Studio Marketplace\u003c/a\u003e.\n\n## Code Snippets\n\n### Log\n\nGenerates a static `ILog` instance for the current class.\n\nUsage: `log`\n\nOutput:\n\n```\nprivate static readonly ILog Log = LogManager.GetCurrentClassLogger();\n```\n\n### Model\n\nCreates a new model based on the `ModelBase` class.\n\nUsage: `model`\n\nOutput:\n\n```\n[Serializable]\npublic class MyModel : ModelBase\n{\n    public MyModel()\n    {\n    }\n\n    // TODO: Define your custom properties here using the 'modelprop' code snippet\n}\n\n```\n\n### Model property\n\nCreates a model property for a class based on `ModelBase`.\n\nUsage: `modelprop` or `modelpropfody`\n\nOutput:\n\n```\npublic string FirstName\n{\n    get { return GetValue\u003cstring\u003e(FirstNameProperty); }\n    set { SetValue(FirstNameProperty, value); }\n}\n\npublic static readonly PropertyData FirstNameProperty = RegisterProperty(nameof(FirstName), typeof(string), null);\n```\n\n### Model property with change notifications\n\nCreates a model property for a class based on `ModelBase` and includes a property change notification method.\n\nUsage: `modelpropchanged` or `modelpropchangedfody`\n\nOutput:\n\n```\npublic string FirstName\n{\n    get { return GetValue\u003cstring\u003e(FirstNameProperty); }\n    set { SetValue(FirstNameProperty, value); }\n}\n\npublic static readonly PropertyData FirstNameProperty = RegisterProperty(nameof(FirstName), typeof(string), null, (sender, e) =\u003e ((ContainingClass)sender).OnFirstNameChanged());\n\nprivate void OnFirstNameChanged()\n{\n    // TODO: Implement logic\n}\n```\n\n### View model\n\nCreates a view model class based on the `ViewModelBase`.\n\nUsage: `vm`\n\nOutput:\n\n```\npublic class MainViewModel : ViewModelBase\n{\n    public MainViewModel()\n    {\n    }\n\n    public override string Title { get { return \"Main\"; } }\n\n    // TODO: Register properties using 'vmprop'\n    // TODO: Register properties that represent models using 'vmpropmodel'\n    // TODO: Register properties that map to models using 'vmpropviewmodeltomodel'\n    // TODO: Register commands using 'vmcommand', 'vmcommandwithcanexecute', 'vmtaskcommand' or 'vmtaskcommandwithcanexecute'\n\n    protected override async Task InitializeAsync()\n    {\n        await base.InitializeAsync();\n\n        // TODO: Add initialization logic like subscribing to events\n    }\n\n    protected override async Task CloseAsync()\n    {\n        // TODO: Add uninitialization logic like unsubscribing from events\n\n        await base.CloseAsync();\n    }\n}\n```\n\n### View model property\n\nCreates a view model class based on the `ViewModelBase`.\n\nUsage: `vmprop` or `vmpropfody`\n\nOutput:\n\n```\npublic string FirstName\n{\n    get { return GetValue\u003cstring\u003e(FirstNameProperty); }\n    set { SetValue(FirstNameProperty, value); }\n}\n\npublic static readonly PropertyData FirstNameProperty = RegisterProperty(nameof(FirstName), typeof(string), null);\n```\n\n### View model property with change notifications\n\nCreates a view model property for a class based on `ViewModelBase` and includes a property change notification method.\n\nUsage: `vmpropchanged` or `vmpropchangedfody`\n\nOutput:\n\n```\npublic string FirstName\n{\n    get { return GetValue\u003cstring\u003e(FirstNameProperty); }\n    set { SetValue(FirstNameProperty, value); }\n}\n\npublic static readonly PropertyData FirstNameProperty = RegisterProperty(nameof(FirstName), typeof(string), null, (sender, e) =\u003e ((ContainingClass)sender).OnFirstNameChanged());\n\nprivate void OnFirstNameChanged()\n{\n    // TODO: Implement logic\n}\n```\n\n### View model property as model\n\nCreates a view model property decorated with the `Model` attribute.\n\nUsage: `vmpropmodel` or `vmpropmodelfody`\n\nOutput:\n\n```\n[Model]\npublic Human Person\n{\n    get { return GetValue\u003cHuman\u003e(PersonProperty); }\n    private set { SetValue(PersonProperty, value); }\n}\n\npublic static readonly PropertyData PersonProperty = RegisterProperty(nameof(Person), typeof(Human));\n```\n\n### View model property with view model to model mapping\n\nCreates a view model property with a mapping to a model.\n\nUsage: `vmpropviewmodeltomodel` or `vmpropviewmodeltomodelfody`\n\nOutput:\n\n```\n[ViewModelToModel(nameof(Person))]\npublic string FirstName\n{\n    get { return GetValue\u003cstring\u003e(FirstNameProperty); }\n    set { SetValue(FirstNameProperty, value); }\n}\n\npublic static readonly PropertyData FirstNameProperty = RegisterProperty(nameof(FirstName), typeof(string));\n```\n\n### View model command\n\nCreates a view model command with an execute method.\n\nUsage: `vmcommand`\n\nOutput:\n\n```\npublic Command MyCommand { get; private set; }\n\n// TODO: Move code below to constructor\nMyCommand = new Command(OnMyCommandExecute);\n// TODO: Move code above to constructor\n\nprivate void OnMyCommandExecute()\n{\n    // TODO: Handle command logic here\n}\n```\n\n### View model command with can execute\n\nCreates a view model command with an execute and can execute method.\n\nUsage: `vmcommandwithcanexecute`\n\nOutput:\n\n```\npublic Command MyCommand { get; private set; }\n\n// TODO: Move code below to constructor\nMyCommand = new Command(OnMyCommandExecute, OnMyCommandCanExecute);\n// TODO: Move code above to constructor\n\nprivate bool OnMyCommandCanExecute()\n{\n    return true;\n}\n\nprivate void OnMyCommandExecute()\n{\n    // TODO: Handle command logic here\n}\n```\n\n### View model task command\n\nCreates a view model task-based command with an execute method.\n\nUsage: `vmtaskcommand`\n\nOutput:\n\n```\npublic TaskCommand MyCommand { get; private set; }\n\n// TODO: Move code below to constructor\nMyCommand = new TaskCommand(OnMyCommandExecuteAsync);\n// TODO: Move code above to constructor\n\nprivate async Task OnMyCommandExecuteAsync()\n{\n    // TODO: Handle command logic here\n}\n```\n\n### View model task command with can execute\n\nCreates a view model task-based command with an execute and can execute method.\n\nUsage: `vmtaskcommandwithcanexecute`\n\nOutput:\n\n```\npublic TaskCommand MyCommand { get; private set; }\n\n// TODO: Move code below to constructor\nMyCommand = new TaskCommand(OnMyCommandExecuteAsync, OnMyCommandCanExecute);\n// TODO: Move code above to constructor\n\nprivate bool OnMyCommandCanExecute()\n{\n    return true;\n}\n\nprivate async Task OnMyCommandExecuteAsync()\n{\n    // TODO: Handle command logic here\n}\n```\n\n## Templates\n\nTODO: Describe all templates\n\n## How to ensure local templates show up\n\nOpen the Visual Studio command prompt in administrator mode and run the command below:\n\n```\ndevenv /installvstemplates\n```\n\n## How to contribute?\n\nWe love improvements to the templates via contributions. Below\nis a guide that should help you set up your environment.\n\n1. Copy the templates from the repository to VS 2019\n\nUse the `scripts - Copy templates to VS2019.ps1` script or manually copy the templates from `/templates/` to `%documents%\\Visual Studio 2019\\`.\n\n**Note that they should be put in the right directory. If you are not sure, always use the script.**\n\n2. Update and test the templates\n\nTo customize the templates, edit the files in `%documents%\\Visual Studio 2019\\Templates`.\n\nOnce customized, you can directly test them in Visual Studio.\n\n3. Copy the changes back\n\nTo copy the updated templates back to the solution, use the script `scripts - Copy templates from VS2019.ps1` or manually copy the templates from `%documents%\\Visual Studio 2019\\` to `/templates/`.\n\n4. Zip the templates and copy the templates to the VSIX projects\n\nTo zip and copy the templates, use the script `scripts - Copy templates to VSIX projects.ps1`\n\n5. Create a PR (Pull Request) with the changes for review.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatel%2Fcatel.templates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatel%2Fcatel.templates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatel%2Fcatel.templates/lists"}