Welcome to WinFormedge!
This is a desktop application integrated with modern web technologies.
Welcome to WinFormedge!
This is a desktop application integrated with modern web technologies.
Current count: @currentCount
@code { private int currentCount = 0; private void IncrementCount() { currentCount++; } } ``` -------------------------------- ### Register Embedded Resources with Virtual Hostname Source: https://github.com/xuanchenlin/winformedge/blob/master/docs/using-web-resources.md Use SetVirtualHostNameToEmbeddedResourcesMapping within the Load event to ensure the mapping occurs after WebView2 initialization. ```csharp using WinFormedge; namespace MyApp; internal class MyWindow : Formedge { public MyWindow() { // Set URL to the mapped virtual hostname Url = "https://appresources.local/index.html"; Load += (s, e) => { // Map embedded resources to virtual hostname SetVirtualHostNameToEmbeddedResourcesMapping(new WinFormedge.WebResource.EmbeddedFileResourceOptions { Scheme = "https", HostName = "appresources.local", ResourceAssembly = typeof(MyWindow).Assembly, DefaultFolderName = "wwwroot" }); }; } } ``` -------------------------------- ### CSS Window State Styling Source: https://github.com/xuanchenlin/winformedge/blob/master/src/MinimalExampleApp/wwwroot/index.html Defines layout and visual indicators for window activation states and drag regions. ```css html, body { height: 100%; margin: 0; padding: 0; } .window__titlbar--shown header { display: none; } .window__titlbar--hidden header { color: white; padding: 10px; text-align: center; app-region: drag; } .window--activated header { } .window--deactivated header { } main { padding: 20px; } #activated-status { width: 60px; } .window--activated #activated-status { background-color: green; } .window--deactivated #activated-status { background-color: dimgray; } .window--activated #activated-status:after { background-color: green; content: "ACTIVATED"; } .window--deactivated #activated-status:after { background-color: dimgray; content: "DEACTIVATE" } ``` -------------------------------- ### Define Razor Imports Source: https://github.com/xuanchenlin/winformedge/blob/master/src/WinFormedge.Blazor/README.md Add the necessary namespace imports for Blazor components. ```razor @using Microsoft.AspNetCore.Components.Web ``` -------------------------------- ### JavaScript Window Interaction Source: https://github.com/xuanchenlin/winformedge/blob/master/src/MinimalExampleApp/wwwroot/index.html Attaches a click event listener to the openChildWindow button to trigger a host object method. ```javascript (() => { const btn = document.getElementById("openChildWindow"); if (btn) { btn.addEventListener("click", () => { chrome.webview.hostObjects.sync.testWindow.OpenSubWindow(); }); } })(); ``` -------------------------------- ### Implement CSS Shadow Effect Source: https://github.com/xuanchenlin/winformedge/blob/master/docs/using-different-window-styles.md Apply a box shadow to the window element to create a custom border effect. ```css box-shadow: 0px 5px 20px #333333; ``` -------------------------------- ### SetVirtualHostNameToEmbeddedResourcesMapping Method Signature Source: https://github.com/xuanchenlin/winformedge/blob/master/docs/using-web-resources.md The primary method used to configure the mapping of a virtual hostname to embedded resources. ```csharp public void SetVirtualHostNameToEmbeddedResourcesMapping(EmbeddedFileResourceOptions options); ``` -------------------------------- ### SetVirtualHostNameToEmbeddedResourcesMapping Source: https://github.com/xuanchenlin/winformedge/blob/master/docs/using-web-resources.md Configures the mapping between a virtual hostname and embedded resources within an assembly. ```APIDOC ## SetVirtualHostNameToEmbeddedResourcesMapping ### Description Configures the mapping between a virtual hostname and embedded resources within an assembly. This allows the WebView2 control to resolve requests made to a specific virtual host to files embedded in the application assembly. ### Method Signature `public void SetVirtualHostNameToEmbeddedResourcesMapping(EmbeddedFileResourceOptions options);` ### Parameters - **options** (EmbeddedFileResourceOptions) - Required - An object containing the configuration for the resource mapping. ### EmbeddedFileResourceOptions Properties - **Scheme** (string) - The protocol part of the virtual hostname (e.g., "https"). - **HostName** (string) - The host part of the virtual hostname (e.g., "appresources.local"). - **ResourceAssembly** (Assembly) - The assembly containing the embedded resources. - **DefaultFolderName** (string) - The default folder name for embedded resources (e.g., "wwwroot"). - **DefaultNamespace** (string) - The default namespace prefix for embedded resources. - **OnFallback** (WebResourceFallbackDelegate) - A callback delegate for handling requests when a resource is not found. ``` -------------------------------- ### Window Dragging with -webkit-app-region Source: https://github.com/xuanchenlin/winformedge/blob/master/docs/window-interaction-apis.md Use the CSS -webkit-app-region property to define draggable and non-draggable regions within the window. ```APIDOC ## CSS -webkit-app-region ### Description Defines which areas of the window can be used to drag the application window. ### Usage - `drag`: Enables window dragging for the element. - `no-drag`: Disables window dragging for the element. ### Example ```css .title-bar { -webkit-app-region: drag; } .title-bar .close-button { -webkit-app-region: no-drag; } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.