{"id":24569392,"url":"https://github.com/zumwani/common-wpf","last_synced_at":"2026-06-17T23:31:15.700Z","repository":{"id":50744467,"uuid":"330503387","full_name":"Zumwani/Common-wpf","owner":"Zumwani","description":"A collection of useful libraries for wpf.","archived":false,"fork":false,"pushed_at":"2024-01-04T16:16:16.000Z","size":508,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-22T14:31:36.353Z","etag":null,"topics":["csharp","utility","wpf","xaml"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"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/Zumwani.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":"2021-01-17T22:56:43.000Z","updated_at":"2023-11-10T21:36:50.000Z","dependencies_parsed_at":"2025-01-23T15:25:33.789Z","dependency_job_id":"a7272a06-00fc-4495-9e90-b972f5b41a25","html_url":"https://github.com/Zumwani/Common-wpf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Zumwani/Common-wpf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zumwani%2FCommon-wpf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zumwani%2FCommon-wpf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zumwani%2FCommon-wpf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zumwani%2FCommon-wpf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zumwani","download_url":"https://codeload.github.com/Zumwani/Common-wpf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zumwani%2FCommon-wpf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273228029,"owners_count":25067705,"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-09-02T02:00:09.530Z","response_time":77,"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":["csharp","utility","wpf","xaml"],"created_at":"2025-01-23T15:23:00.356Z","updated_at":"2026-06-17T23:31:15.657Z","avatar_url":"https://github.com/Zumwani.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Common-wpf\nA collection of useful libraries for wpf.\n\nAll utilities are available as NuGet packages:\n\u003e [Install-Package Common-wpf.Settings](https://www.nuget.org/packages/Common-wpf.Settings/)\\\n\u003e [Install-Package Common-wpf.Utility](https://www.nuget.org/packages/Common-wpf.Utility/)\n\n## Common.Settings\n\nA settings system for wpf that allows easy access for both code behind and xaml, with auto-complete and two way bindings.\n\n```csharp\n\nnamespace Example.Settings; //namespace we need to import in xaml (xmlns:settings=\"clr-namespace:Example.Settings\")\n\npublic class WindowTitle : Setting\u003cstring, WindowTitle\u003e\n{\n    public override string? DefaultValue =\u003e \"Example\";\n}\n\npublic class ExampleCollection : CollectionSetting\u003cstring, Collection\u003e\n{\n    public override IEnumerable\u003cstring\u003e? DefaultItems =\u003e new[] { \"\" };\n}\n\npublic class ExampleDictionary : DictionarySetting\u003cstring, string, Dictionary\u003e\n{\n    public override Dictionary\u003cstring, string\u003e? DefaultItems =\u003e new() { { \"testKey\", \"testValue\" } };\n}\n\npublic class ExampleFlags : FlagSetting\u003cstring, Flag\u003e\n{\n    public override Dictionary\u003cstring, bool\u003e? DefaultItems =\u003e null; //null is default, so no reason to override, but for example purposes\n}\n\n```\n\n```xaml\n\u003cWindow\n  ..\n  xmlns:settings=\"clr-namespace:Example.Settings\"\n  xmlns:settingsUtility=\"common://settings\"\n  Width=\"800\" Height=\"450\" WindowStartupLocation=\"Manual\"\n  Title=\"{settings:WindowTitle Mode=OneWay}\"\n  Settings.SavePosition=\"True\"\u003e\u003c!--Attached property for saving window pos--\u003e\n  ..\n\u003c/Window\u003e\n```\n\n```csharp\npublic Window : System.Windows.Window\n{\n\n    private void Window_Loaded(..)\n    {\n\n        //Set some new values through code\n        Settings.WindowTitle.Current.Value = \"This is an example\";\n        Settings.ExampleCollection.Current.Add(\"test\");\n        Settings.ExampleDictionary.Current.Set(\"test\", \"value\");\n        Settings.ExampleFlags.Current.Set(\"test\");\n        Settings.ExampleFlags.Current.Unset(\"test\");\n\n        //We delay the actual write for a bit to ensure we don't spam write value to registry.\n        //While delay duration can be modified using Common.Settings.SettingsUtility.DelayDuration property,\n        //the following call ensures all pending writes are done at once.\n        //This is by automatically called during App.Current.Exit event, by default.\n        Common.Settings.SettingsUtility.SavePending(); \n\n        //List all settings and values\n        foreach (var setting in Common.Settings.SettingsUtility.Enumerate())\n            if (Common.Settings.SettingsUtility.GetJson(setting, out var json))\n                Debug.WriteLine($\"{setting.Name} ({setting.Name}):\\n{json}\\n\");\n\n    }\n\n}\n\n```\n\n## Common.Utility\nContains utility functions for wpf.\n\n```xml\n\u003cWindow ..\n  xmlns:common=\"http://common\"\n  Common:IsVisibleInAltTab=\"False\"\u003e\n\n\u003c/Window\u003e\n```\n```csharp\npublic class Window : System.Windows.Window\n{\n\n    private void Window_Loaded(..)\n    {\n\n        //Center window on the screen that the window is currently on\n        this.Center();\n        this.CenterVertically();\n        this.CenterHorizontally();\n\n        //Restricts window from being moved offscreen (supports multiple monitors)\n        this.MakeSureVisible();\n\n    }\n}\n\n```\n```csharp\npublic class App : System.Windows.Application\n{\n\n    void Application_Startup(object sender, StartupEventArgs e)\n    {\n    \n        //Makes sure app runs as single instance\n        if (AppUtility.IsSecondaryInstance(HandleArguments))\n        {\n            Shutdown();\n            return;\n        }\n        \n        //Enable auto start, can be bound to using two-way binding\n        //{Binding Source={x:Static common:AppUtility.AutoStart}, Path=IsEnabled, Mode=TwoWay}\n        AppUtility.AutoStart.IsEnabled = true;\n\n    }\n    \n    //Handle command line arguements here, which are passed from secondary instance\n    void HandleArguments(AppArguments arguments)\n    { }\n    \n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzumwani%2Fcommon-wpf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzumwani%2Fcommon-wpf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzumwani%2Fcommon-wpf/lists"}