Support for WindowStyle
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 296
Description
Description
Creating custom UI is a MUST. Replacing the Titlebar is a must-have for Windows. This is all in the context of a Blazor Hybrid app.
I have tried messing with ContentPage and Application tags in XAML, and haven't got anywhere. The closest I got was using the following abomination, but it only got me half-way there.
var hwnd = WindowNative.GetWindowHandle(del);
var style = User32.GetWindowLong(hwnd, User32.WindowLongIndexFlags.GWL_STYLE);
style &= ~(int)User32.SetWindowLongFlags.WS_CAPTION;
style = style & ~(int)User32.SetWindowLongFlags.WS_SYSMENU;
style = style & ~(int)User32.SetWindowLongFlags.WS_THICKFRAME;
style = style & ~(int)User32.SetWindowLongFlags.WS_MINIMIZE;
style = style & ~(int)User32.SetWindowLongFlags.WS_MAXIMIZEBOX;
style = style & ~(int)User32.SetWindowLongFlags.WS_MAXIMIZE;
style = style & ~(int)User32.SetWindowLongFlags.WS_MINIMIZEBOX;
var test1 = User32.SetWindowLong(WindowNative.GetWindowHandle(del), User32.WindowLongIndexFlags.GWL_STYLE, (User32.SetWindowLongFlags)style);
var test2 = User32.SetWindowLong(hwnd,
User32.WindowLongIndexFlags.GWL_EXSTYLE,
(User32.SetWindowLongFlags)(User32.GetWindowLong(hwnd, User32.WindowLongIndexFlags.GWL_EXSTYLE))
| User32.SetWindowLongFlags.WS_EX_DLGMODALFRAME);
var test3 = User32.SetWindowPos(hwnd, new IntPtr(0), 0, 0, 0, 0, User32.SetWindowPosFlags.SWP_NOMOVE | User32.SetWindowPosFlags.SWP_NOSIZE | User32.SetWindowPosFlags.SWP_FRAMECHANGED);
The following didn't get me any closer either:
builder.ConfigureLifecycleEvents(lifecycle => {
lifecycle.AddWindows(windows => windows.OnWindowCreated((del) => {
del.ExtendsContentIntoTitleBar = true;
}));
});
My attempted workaround for a frameless/borderless MAUI app. This failed horribly:

Maybe I'm just missing something.
Public API Changes
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
WindowStyle="None"
to perform the same as
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowStyle="None"
where WindowStyle completely hides the Titlebar.
Intended Use-Case
Any application where the developer wants to create a custom title bar. Almost every app has this and is a really important thing to have in Blazor Hybrid/MAUI.
Of course, this should only affect Windows, but maybe there's a similar toggle for Mac/Linux? Anyway, regardless, this is something that's really needed if it's not already here.
I may have completely missed it and am doing something I shouldn't be.
Heck, even VS has a custom title bar:

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proposed ContentPage WindowStyle XAML API and the Windows ConfigureLifecycleEvents/OnWindowCreated entry point described in the issue. Review how the existing WindowNative and User32 workaround changes title-bar styles; done means WindowStyle="None" hides the Windows title bar for a MAUI or Blazor Hybrid ContentPage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100