{"id":20995539,"url":"https://github.com/tesar-tech/customaccelerators","last_synced_at":"2025-10-09T08:40:43.140Z","repository":{"id":112971287,"uuid":"268484139","full_name":"tesar-tech/CustomAccelerators","owner":"tesar-tech","description":"Library and XAML control for keyboard ⌨ shortcuts customization.","archived":false,"fork":false,"pushed_at":"2020-06-19T16:59:05.000Z","size":2579,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-27T04:22:08.408Z","etag":null,"topics":["keyboard","keyboard-shortcuts","uwp","xaml"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/CustomAccelerators","language":"C#","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/tesar-tech.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}},"created_at":"2020-06-01T09:52:29.000Z","updated_at":"2020-06-19T17:01:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"aed990ca-3743-4c00-afb3-ba1d9b0c1bd1","html_url":"https://github.com/tesar-tech/CustomAccelerators","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tesar-tech/CustomAccelerators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tesar-tech%2FCustomAccelerators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tesar-tech%2FCustomAccelerators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tesar-tech%2FCustomAccelerators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tesar-tech%2FCustomAccelerators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tesar-tech","download_url":"https://codeload.github.com/tesar-tech/CustomAccelerators/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tesar-tech%2FCustomAccelerators/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001049,"owners_count":26082991,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["keyboard","keyboard-shortcuts","uwp","xaml"],"created_at":"2024-11-19T07:24:35.997Z","updated_at":"2025-10-09T08:40:43.110Z","avatar_url":"https://github.com/tesar-tech.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Custom Accelerators\n\nLibrary and XAML control for keyboard ⌨ shortcuts customization.\n\nTry it in [Video Detail Player](https://www.microsoft.com/en-us/p/video-detail-player/9p34ghb2h88r) or in the sample app.\n\n\u003cimg src=\"vdp_changing_shortcuts.gif\" width=\"500\"\u003e\n\n## Usage\n\n(See the sample project in this repo for details)\n\n- Add the package to your UWP project:\n\n    [![CustomAccelerators](https://img.shields.io/nuget/v/CustomAccelerators.svg)](https://www.nuget.org/packages/CustomAccelerators/)\n  \u003e Install-Package CustomAccelerators\n\n- Add reference in XAML:\n\n    ``` xml\n    \u003cPage\n    ...\n    xmlns:ca=\"using:CustomAccelerators\"\u003e\n    ```\n\n- Use attached property to add custom accelerator\n\n    ``` xml\n    \u003cButton Content=\"Hello\" ca:Extension.Identity=\"HelloCa\"  /\u003e\n     \u003c!--this will also update the tooltip of the button--\u003e\n    ```\n\n- Add definitions of accelerators somewhere (e.g. in `OnNavigatedTo` of the Page).\n\n```csharp\nvar acceleratorsList = new List\u003c(string identity, string label, VirtualKey key, VirtualKeyModifiers modifiers)\u003e()\n{\n    (\"HelloCa\",\"I am Hello Button\",VirtualKey.H,VirtualKeyModifiers.Control|VirtualKeyModifiers.Shift),\n    (\"Another Accelerator\",\"\",VirtualKey.PageDown,VirtualKeyModifiers.None)\n};\n\nAcceleratorsManager.AddDefaultsAndLoadFromStorage(acceleratorsList);\n```\n\n- Add `CustomAcceleratorsEditControl` somewhere in your xaml.\n\n```xml\n\u003cca:CustomAcceleratorsEditControl /\u003e\n\u003c!--this control allows to edit keybord shortcuts--\u003e\n```\n\n## Notes\n\n- You can also set accelerator without using attached properties:\n\n   ``` xml\n    \u003cButton Content=\"Hello\" \u003e\n        \u003cButton.KeyboardAccelerators\u003e\n            \u003cca:CustomAccelerator  Identity=\"HelloCa\"/\u003e\n        \u003c/Button.KeyboardAccelerators\u003e\n    \u003c/Button\u003e\n    \u003c!--this will NOT automaticaly update the tooltip of the button--\u003e\n    ```\n\n- You can enable/disable the accelerator through the attached property:\n\n  ```xml\n   \u003cButton ca:Extension.Identity=\"SimpleAccelerator\" ca:Extension.IsEnabled=\"True\"/\u003e\n  ```\n- Attached property has one great feature  - it changes tooltip of button (and appbarButton) when accelerator is changed (this behaviour is not supported with basic accelerators).\n- Why is it neccessary to set accelerators somewhere in C# code?\n  - Main reason is necessity to reach all accelerators in one place (for edit control). Accelerators from all pages, event those, that aren't loaded yet. \n- Why set the accelerators in `OnNavigatedTo` method?\n  - It's not requisite. You can set this also in `OnLaunched` of `App.xaml.cs`, but note there are some IO operations (loading settings) that may delay the startup.\n- It saves the shortcuts persistently (using local settings).\n- You can't edit the appearance of `CustomAcceleratorsEditControl` (yet).\n- Dont't set `Key`, `Modifiers` or `Label` in xaml. Only within definitions.\n- It doesn't check if there are more action with same shortcut. In such case, just one action will be invoked.\n- There are cases when you want to use two accelerator that invoke same action. No problem.\n  - It's primary made for this special `CommandBar` [bug and its workarround](https://stackoverflow.com/questions/53735503/keyboard-accelerator-stops-working-in-uwp-app/62025749#62025749).\n- What about localization?\n  - You can do it this way:\n\n  ```csharp\n   var rl = ResourceLoader.GetForCurrentView();\n   acceleratorsList = acceleratorsList.Select(x =\u003e { x.label = rl.GetString(x.identity);return x; }).ToList();\n  ```\n\n  - The [ResourceExtractor](https://github.com/tesar-tech/ResourceExtractor#custom-accelerators) is also prepared for this and will automatically modify the `.resw` with Identities and Labels.\n\n- It's not perfect, I know 🙃 . If you have anything to say about it, don't be shy and open an issue. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftesar-tech%2Fcustomaccelerators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftesar-tech%2Fcustomaccelerators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftesar-tech%2Fcustomaccelerators/lists"}