How can I vanish the white line right beneath the title bar while using WinUI3 / ThemeService?

56 views Asked by At
    protected override void Initialize(IApplicationBuilder builder)
    {
        Window = builder.Window;

        _themeService = new ThemeService();
        _themeService.Initialize(Window);
        _themeService.ConfigTitleBar(new TitleBarCustomization
        {
            TitleBarWindowType = TitleBarWindowType.None,
        });
        _themeService.SetElementTheme(ElementTheme.Dark);

        MaxWindow();

        base.Initialize(builder);
    }

The ShadowWindow is invoked from package <Vanara.PInvoke.User32 3.4.17>

    private static void MaxWindow()
    {
        var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(Window);

        User32.ShowWindow(hwnd, ShowWindowCommand.SW_MAXIMIZE);
    }

This is invoked and the screenshot depicts below that there is a line with package <WinUICommunity.Core 6.4.0>:

enter image description here

(In full screen mode, the white line is not appearing)

The shell view is created this way then becomes the Window's content:

        protected override UIElement CreateShell()
        {
           var shell = Container.Resolve<Shell>();

#if WINDOWS
            shell.Loaded += (s, e) =>
            {
                MainXamlRoot = (s as UIElement).XamlRoot;
            };
#endif
            return shell;
        }

Shell Xaml, which has the regions but none of them tampers with the title bar:

<ContentControl
    x:Class="Weather.History.Mvvm.Views.Shell"
    xmlns:prismmvvm="using:Prism.Mvvm"
    xmlns:prism="using:Prism.Navigation.Regions"
    prismmvvm:ViewModelLocator.AutowireViewModel="True"
    xmlns:inf="using:Weather.History.Prism"
    xmlns:view="using:Weather.History.Mvvm.Views"
    HorizontalContentAlignment="Stretch"
    VerticalContentAlignment="Stretch"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid>
        
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <ContentControl prism:RegionManager.RegionName="{x:Bind inf:RegionNames.CarouselView}" Grid.Row="0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"/>
        <ContentControl prism:RegionManager.RegionName="{x:Bind inf:RegionNames.Console}" Grid.Row="1" HorizontalContentAlignment="Stretch" VerticalAlignment="Bottom"/>
        
    </Grid>

</ContentControl>
0

There are 0 answers