ModernWpf icon indicating copy to clipboard operation
ModernWpf copied to clipboard

Strange white bar

Open nik9play opened this issue 5 years ago • 4 comments

White bar appears on top of window with ui:WindowHelper.UseModernWindowStyle="True" when DPI scale in windows > 100% изображение

nik9play avatar Apr 23 '20 20:04 nik9play

I tried scaling from 125% to 250% in Windows 10 version 1909 but wasn't able to reproduce this. Knowing your OS version would probably be helpful.

Kinnara avatar Apr 26 '20 16:04 Kinnara

Windows 10 1909 125%. However on 1809 all is fine.

nik9play avatar Apr 26 '20 17:04 nik9play

Could you try setting the following WindowChrome on the window and see if the issue goes away? I'm unable to test this because I can't reproduce the behavior on my machine.

<WindowChrome.WindowChrome>
    <WindowChrome
        CaptionHeight="{DynamicResource TitleBarHeight}"
        CornerRadius="0"
        GlassFrameThickness="{x:Static WindowChrome.GlassFrameCompleteThickness}"
        UseAeroCaptionButtons="False" />
</WindowChrome.WindowChrome>

If the issue persists, try adding the following code to the window's code-behind. If this succeeds I'll consider incorporating it into the library.

protected override void OnSourceInitialized(EventArgs e)
{
    base.OnSourceInitialized(e);

    var hwnd = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
    hwnd.CompositionTarget.BackgroundColor = Colors.Black;
}

Kinnara avatar May 06 '20 11:05 Kinnara

Sorry that i didn't mention this before, but I was checking it only on a VMware virtual machine. Now I checked it on my host machine and I can't reproduce the behavior either. So I think it something to do with VM drivers or someting.

However, this on VM makes window white, and nothing on host machine.

<WindowChrome.WindowChrome>
    <WindowChrome
        CaptionHeight="{DynamicResource TitleBarHeight}"
        CornerRadius="0"
        GlassFrameThickness="{x:Static WindowChrome.GlassFrameCompleteThickness}"
        UseAeroCaptionButtons="False" />
</WindowChrome.WindowChrome>

And it doesn't change anything anywhere.

protected override void OnSourceInitialized(EventArgs e)
{
    base.OnSourceInitialized(e);

    var hwnd = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
    hwnd.CompositionTarget.BackgroundColor = Colors.Black;
}

nik9play avatar May 06 '20 11:05 nik9play