{"id":30663304,"url":"https://github.com/cosmatevs/blazorwinforms-customtitlebar","last_synced_at":"2026-04-17T12:34:18.036Z","repository":{"id":307163279,"uuid":"1027494270","full_name":"Cosmatevs/BlazorWinForms-CustomTitleBar","owner":"Cosmatevs","description":"A .NET 8 template for a desktop Blazor app with a custom title bar.","archived":false,"fork":false,"pushed_at":"2025-07-29T18:14:27.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-29T21:05:27.241Z","etag":null,"topics":["blazor","blazor-desktop","desktop","net","netcore","winforms"],"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/Cosmatevs.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,"zenodo":null}},"created_at":"2025-07-28T05:19:54.000Z","updated_at":"2025-07-29T18:14:30.000Z","dependencies_parsed_at":"2025-07-29T21:05:34.358Z","dependency_job_id":null,"html_url":"https://github.com/Cosmatevs/BlazorWinForms-CustomTitleBar","commit_stats":null,"previous_names":["cosmatevs/blazorwinforms-customtitlebar"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Cosmatevs/BlazorWinForms-CustomTitleBar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cosmatevs%2FBlazorWinForms-CustomTitleBar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cosmatevs%2FBlazorWinForms-CustomTitleBar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cosmatevs%2FBlazorWinForms-CustomTitleBar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cosmatevs%2FBlazorWinForms-CustomTitleBar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cosmatevs","download_url":"https://codeload.github.com/Cosmatevs/BlazorWinForms-CustomTitleBar/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cosmatevs%2FBlazorWinForms-CustomTitleBar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273010994,"owners_count":25030369,"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-08-31T02:00:09.071Z","response_time":79,"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":["blazor","blazor-desktop","desktop","net","netcore","winforms"],"created_at":"2025-08-31T17:04:49.556Z","updated_at":"2026-04-17T12:34:17.990Z","avatar_url":"https://github.com/Cosmatevs.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is a .NET 8 template for a desktop Blazor app with a custom title bar.\\\nImplemented with WinForms, using the `BlazorWebView` component.\n\n![Preview window](readme-images/preview.png)\n\n# Goals\n- Recreate the title bar as a Blazor component – to simplify customization and integration with the rest of a Blazor desktop app.\n- Make the app window behave as similarly as possible to a native Windows window.\n\nMany window features work out of the box in a WinForms form. However, some features had to be reimplemented to make them usable in Blazor.\n\n# Usage\nFor a Visual Studio environment, make sure you have the following workloads installed (via Visual Studio Installer):\n- ASP.NET and web development\n- .NET desktop development\n\nThen download the source code of this and open the `.sln` file in Visual Studio.\n\nThe `BlazorWinFormsCustomTitleBar` project contains a custom WinForms form with a Blazor component, as well as the necessary functions and properties to implement a custom title bar.\\\nThis is only a class library, not a runnable project.\n\nThe `BlazorWinFormsCustomTitleBarDemo` project is an example implementation you can use as a start point.\n\n# Main features\n*at least some of these features were missing from other solutions I've found*\n- resize the window by dragging its borders\n  - you can implement top border resizing with `TopBorderLeftButtonDown(doubleClick:false)` and css `cursor: n-resize`; other borders and all corners work automatically\n- resize the window to the full height by double-clicking the top border\n  - you can implement this with `TopBorderLeftButtonDown(doubleClick:true)`\n- no window resizing limits\\\n  some solutions I've found required limiting the window size to the size of one of the screens\n- the original Windows borders\\\n  in Windows 11, this means rounded corners and a shadow \n- no white bar on the top border\n- drag the window by dragging the title bar\\\n  this also allows you to use snap layouts in Windows 11\n  - you can implement this with `TitleBarLeftButtonDown(doubleClick:false)`\n- maximize/restore the window by double-clicking the title bar\n  - you can implement this with `TitleBarLeftButtonDown(doubleClick:true)`\n- show the system menu by right-clicking the title bar\n  - you can implement this with `TitleBarRightButtonUp()`\n- minimize, restore/maximize, and close the window using buttons\n  - you can implement these with `Minimize()`, `ToggleMaximization()`, and `Close()`\n- a maximized window does not cover the taskbar\n- the title bar changes appearance when the window is out of focus\n  - you can implement this using the `IsActive` property and the `ActiveChanged` event\n- working Windows shortcuts, such as `Alt`+`F4` and `Alt`+`Space`\n- seems to work fine in a multi-screen setup\n\nThe above mentioned functions, properties, and events are part of the `TitleBarLessBlazorWindow` class. Use them in your custom Blazor title bar.\n\n# Additional features\n- in Blazor services, the form window instance is a singleton by default\n- you can include your own service declarations with the `AddBlazorServices` property\n- by default, the `WebView` right-click context menu doesn't contain browser-related items such as *Back*, *Refresh*, or *Share*\n  - you can override this implementation with the `WebViewContextMenuRequested` property\n- by default, browser-related keyboard shortcuts, autofill in input fields, and zoom controls are disabled\n  - you can change these settings, as well as others, with the `InitializeWebViewSettings` property\n- light/dark system theme preference detection\n  - exposed as the `SystemPreferredTheme` property and the `SystemPreferredThemeChanged` event\n\n# Known missing features\n- hovering over the maximize/restore button doesn't show the snap layouts menu\\\n  There's an [article about this](https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/ui/apply-snap-layout-menu), but the implementation is not straightforward in this case.\n\n# Potential issues\n- the original Windows title bar is actually hidden outside the window. I haven't encountered any problems with this solution yet, but I'm afraid they might appear at some point.\n\n# Other notes\n- I've tested the solution on Windows 11. I don't know if it works as intended on other systems.\n- I'd be happy to see your suggestions and solutions for the missing features and issues.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcosmatevs%2Fblazorwinforms-customtitlebar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcosmatevs%2Fblazorwinforms-customtitlebar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcosmatevs%2Fblazorwinforms-customtitlebar/lists"}