【问题标题】:Is it possible to remove titlebar from .NET MAUI application in windows?是否可以从 Windows 中的 .NET MAUI 应用程序中删除标题栏?
【发布时间】:2022-10-19 17:18:12
【问题描述】:

我想在 .NET MAUI for Windows 中实现自定义标题栏。为此,我需要删除默认标题栏,但 SetWindowLong 没有按预期工作,特别是标题栏似乎被水平切成两半。

我尝试使用的代码如下:

WindowHandler.Mapper.AppendToMapping("CustomFunc", (handler, view) =>
            {
                var nativeWindow = handler.PlatformView;

                IntPtr hWnd = WinRT.Interop.WindowNative.GetWindowHandle(nativeWindow);
                
                SetWindowLong(hWnd, GWL_STYLE, WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP);

                nativeWindow.Activate();
             });

有谁知道如何解决这个问题? 是否可以避免使用 SetWindowLong 而使用 MAUI 功能?

【问题讨论】:

  • 您能否添加标题栏的屏幕截图,因为它似乎被“切成两半”?这将有助于澄清,谢谢。
  • 我很惊讶SetWindowLong 完全有效,考虑到“现代”应用程序表面上不通过USER32

标签: c# .net windows maui


【解决方案1】:

将行 Shell.NavBarIsVisible="False" 添加到您的 appshell.xaml 如果我正确理解了您的问题,这应该可以

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-16
    • 2015-01-16
    • 2011-08-08
    • 1970-01-01
    相关资源
    最近更新 更多