C
C#8mo ago
Luc ♡

MAUI hide title bar but preserve resize feature

I am able to hide the entire title bar like this. This works great. The reason for doing this is Title bar customisation so it fits with the rest of my application. Two issues: - Not being able to drag the window, well obviously but I could probably re implement this easily. - Resize is set to false, the window cannot be resized anymore. If I re-enable it, there is a small margin at the top that shows up. See attached image, this is the top titlebar that forms. Its slim, but still behaves like a titlebar that is just empty. Now the question is, can i re implement resizing in some way? Or allow it with out the titlebar showing up again? There is little information on how to actually achieve this in MAUI. This is the only working way that I have found yet. Code for hiding the title bar:
builder.ConfigureLifecycleEvents(lifecycleBuilder =>
{
lifecycleBuilder.AddWindows(windowsLifecycleBuilder =>
{
windowsLifecycleBuilder.OnWindowCreated(window =>
{
//use Microsoft.UI.Windowing functions for window
var handle = WinRT.Interop.WindowNative.GetWindowHandle(window);
var id = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(handle);
var appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(id);

if(appWindow.Presenter is OverlappedPresenter presenter)
{
presenter.IsMaximizable = false;
presenter.IsMinimizable = false;
presenter.IsResizable = false;
presenter.SetBorderAndTitleBar(false, false);
}
});
});
});
builder.ConfigureLifecycleEvents(lifecycleBuilder =>
{
lifecycleBuilder.AddWindows(windowsLifecycleBuilder =>
{
windowsLifecycleBuilder.OnWindowCreated(window =>
{
//use Microsoft.UI.Windowing functions for window
var handle = WinRT.Interop.WindowNative.GetWindowHandle(window);
var id = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(handle);
var appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(id);

if(appWindow.Presenter is OverlappedPresenter presenter)
{
presenter.IsMaximizable = false;
presenter.IsMinimizable = false;
presenter.IsResizable = false;
presenter.SetBorderAndTitleBar(false, false);
}
});
});
});
No description
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server