Turning a Blazor Server App into a Blazor Hybrid WPF App
Blazor Server and Blazor Hybrid can both render Razor components, but they run in very different places. In a Blazor Server app, the UI is hosted by ASP.NET Core. The browser connects to the server over SignalR, user events travel back to the server, and the server sends UI updates back to the browser. In a Blazor Hybrid WPF app, the UI is hosted inside a native Windows desktop application. WPF owns the window, BlazorWebView renders Razor components through WebView2, and the components run in-process with the desktop app instead of over a network circuit. That means the main change is not rewriting your Razor UI. The main change is replacing the ASP.NET Core web host with a WPF desktop host. 1. Change the project type A Blazor Server app usually uses the Web SDK: <Project Sdk="Microsoft.NET.Sdk.Web"> For WPF Blazor Hybrid, the project needs Razor support plus WPF support: <Project Sdk="Microsoft.NET.Sdk.Razor"> <PropertyGroup> <OutputType...