-
-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Summary
Feature Request
I'd like to request official support for configuring the main window to launch in fullscreen mode.
Problem
Currently, attempting to modify BlazorDesktopWindow properties (like WindowStyle, WindowState, etc.) from Program.cs results in STA thread errors or Application.Current == null.
Suggested Solution
Expose a safe way to configure the window before RunAsync() is called — for example, via a builder.Window.OnConfigure delegate or similar mechanism.
Use Case
This would allow developers to launch BlazorDesktop apps in fullscreen mode (e.g., for kiosk or dashboard scenarios) without modifying the framework or encountering threading issues.
Thanks for the great work on this project!
Motivation and goals
I'm building a BlazorDesktop application intended to run in kiosk mode, where the app should launch in fullscreen without window borders or title bar.
Currently, there's no documented or supported way to configure the window to fullscreen without encountering STA thread errors or accessing Application.Current, which is null at that point.
Having a built-in way to configure the window (e.g., via a delegate or configuration hook) would make it much easier and safer to support fullscreen scenarios, especially for dashboards, kiosks, or immersive apps.
In scope
- Provide a supported way to configure the BlazorDesktop window before it is shown.
- Allow developers to set properties like WindowStyle, WindowState, ResizeMode, and Topmost safely.
- Avoid STA thread errors when modifying the window from Program.cs.
Out of scope
- Cross-platform fullscreen support (BlazorDesktop is currently Windows-only via WPF).
- Runtime toggling of fullscreen mode (this request is only for initial window configuration).
Risks / unknowns
- Ensuring the configuration hook runs early enough in the app lifecycle to affect the window before it is shown.
- Compatibility with future versions of .NET or WPF.
- Potential side effects if developers misuse the configuration (e.g., hiding the window completely).
Examples
A possible API could look like:
builder.Window.OnConfigure += window =>
{
window.WindowStyle = WindowStyle.None;
window.ResizeMode = ResizeMode.NoResize;
window.WindowState = WindowState.Maximized;
window.Topmost = true;
};
Detailed design
Expose a delegate or configuration method (e.g., builder.Window.OnConfigure) that allows developers to modify the BlazorDesktopWindow instance before it is shown.
This delegate should be invoked internally by the framework after the window is created but before RunAsync() displays it. This would ensure that all window properties can be safely set without requiring access to Application.Current or using Dispatcher.Invoke.