{"id":19418834,"url":"https://github.com/andrewkeepcoding/switchingthemessampleapp","last_synced_at":"2025-02-25T03:43:17.989Z","repository":{"id":119225379,"uuid":"479732428","full_name":"AndrewKeepCoding/SwitchingThemesSampleApp","owner":"AndrewKeepCoding","description":"This is the source code from my YouTube video about switching themes on WinUI 3 app.","archived":false,"fork":false,"pushed_at":"2024-06-13T13:33:05.000Z","size":20,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-07T17:41:49.960Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://youtu.be/w2XdbyNrXBQ","language":"C#","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndrewKeepCoding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-04-09T13:20:32.000Z","updated_at":"2024-06-14T19:56:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"c28ac345-c046-4dc0-82da-ab2e6a085fb1","html_url":"https://github.com/AndrewKeepCoding/SwitchingThemesSampleApp","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/AndrewKeepCoding%2FSwitchingThemesSampleApp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewKeepCoding%2FSwitchingThemesSampleApp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewKeepCoding%2FSwitchingThemesSampleApp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewKeepCoding%2FSwitchingThemesSampleApp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndrewKeepCoding","download_url":"https://codeload.github.com/AndrewKeepCoding/SwitchingThemesSampleApp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240599180,"owners_count":19826959,"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-10T13:15:25.611Z","updated_at":"2025-02-25T03:43:17.965Z","avatar_url":"https://github.com/AndrewKeepCoding.png","language":"C#","readme":"# SwitchingThemesSampleApp\nThis is the source code from my YouTube video about switching themes on WinUI 3 app.\n\nYouTube: https://youtu.be/w2XdbyNrXBQ\n\n# Update\n\nIf you want to use a `ComboBox`:\n\n```xaml\n\u003cComboBox\n    SelectedIndex=\"0\"\n    SelectionChanged=\"ComboBox_SelectionChanged\"\u003e\n    \u003cx:String\u003eDefault\u003c/x:String\u003e\n    \u003cx:String\u003eLight\u003c/x:String\u003e\n    \u003cx:String\u003eDark\u003c/x:String\u003e\n\u003c/ComboBox\u003e\n```\n\nand in code-behind, get the `IThemeSelectorService`:\n\n```cs\nprivate readonly IThemeSelectorService _themeSelectorService = Ioc.Default.GetRequiredService\u003cIThemeSelectorService\u003e();\n```\n\nand handle the `SelectionChanged` event:\n\n```cs\nprivate void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)\n{\n    if (e.AddedItems.FirstOrDefault() is not string themeName ||\n        Enum.TryParse\u003cElementTheme\u003e(themeName, out var theme) is not true)\n    {\n        return;\n    }\n\n    _themeSelectorService.SetTheme(theme);\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewkeepcoding%2Fswitchingthemessampleapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewkeepcoding%2Fswitchingthemessampleapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewkeepcoding%2Fswitchingthemessampleapp/lists"}