Skip to content

WindowChrome causes flickering on resize #1176

Open

Description

@bugproof

Problem description:

I'm using WindowChrome to restyle my window in an easy fast way but the problem is there is flickering when resizing the window, especially when resizing from left to right.

https://stackoverflow.com/questions/51669632/wpf-windowchrome-causing-flickering-on-resize

Minimal repro:

<Window x:Class="View.Settings"
    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"
    Height="570" Width="800" WindowStartupLocation="CenterOwner"
    Background="{StaticResource DarkGrayBackground}" ResizeMode="CanResize" 
    WindowStyle="SingleBorderWindow"
    Title="Settings"
    WindowState="Normal">
<WindowChrome.WindowChrome>
    <WindowChrome 
        CaptionHeight="0"
        CornerRadius="0"
        GlassFrameThickness="1"
        UseAeroCaptionButtons="False"
        ResizeBorderThickness="5"
        NonClientFrameEdges="None"/>
</WindowChrome.WindowChrome>

<Border BorderBrush="Black" BorderThickness="1">
    <DockPanel HorizontalAlignment="Stretch" LastChildFill="True" Margin="0,0,0,0" VerticalAlignment="Stretch">
        <!--TitleBar-->
        <Border DockPanel.Dock="Top" BorderBrush="{StaticResource GrayBorder}" BorderThickness="0,0,0,1">
            <Grid Height="40" Background="{StaticResource WhiteBackground}">
                <DockPanel LastChildFill="False">
                    <Image DockPanel.Dock="Left" Margin="0,0,5,0" ></Image>
                    <Label DockPanel.Dock="Left" Content="{DynamicResource settings}" Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center"></Label>
                    <Button DockPanel.Dock="Right" Style="{StaticResource CloseButton}" x:Name="CloseBtn"/>
                </DockPanel>
            </Grid>
        </Border>
        <!--Left Menu-->
        <Border DockPanel.Dock="Left" Width="180" Background="{StaticResource GrayBackground}" BorderBrush="{StaticResource GrayBorder}" BorderThickness="0,0,1,0">
            <DockPanel Margin="0,40,0,0"  Width="180" LastChildFill="False">
                <Button DockPanel.Dock="Top" Style="{StaticResource BigGrayButton}" 
                            Content="{DynamicResource general}"/>
            </DockPanel>
        </Border>
        <!--Bottom bar-->
        <Border DockPanel.Dock="Bottom" BorderBrush="{StaticResource GrayBorder}" BorderThickness="0,1,0,0" Height="40" Background="{StaticResource WhiteBackground}">
            <DockPanel LastChildFill="False">

            </DockPanel>
        </Border>
        <!--Main Page-->
        <ScrollViewer Background="{StaticResource DarkGrayBackground}" IsTabStop="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" DockPanel.Dock="Top">
            <DockPanel LastChildFill="False" Margin="10,0,10,10">
                <Label DockPanel.Dock="Top" Height="40" FontSize="16" FontWeight="SemiBold" VerticalContentAlignment="Center" Content="{DynamicResource general}"/>
                <Frame DockPanel.Dock="top" x:Name="MainFrame"></Frame>
            </DockPanel>
        </ScrollViewer>
    </DockPanel>
</Border>

Activity

  1. changed the title [-]WindowChrome causing flickering on resize[/-] [+]WindowChrome causes flickering on resize[/+] on Jul 4, 2019
  2. added this to the Future milestone on Jul 8, 2019
  3. added
    Bug
    on Jul 8, 2019
  4. Safirion commented on Oct 11, 2019

    @Safirion

    This problem has bothered developers for almost 20 years, a resolution in the .Net 5 would be welcome...

    https://stackoverflow.com/questions/53000291/how-to-smooth-ugly-jitter-flicker-jumping-when-resizing-windows-especially-drag/53032927

    I have spend one days of my work time to try fixing this unsuccessfully...

  5. wyshmily commented on Nov 14, 2019

    @wyshmily

    This problem is annoying me, too!

  6. JeremyWu917 commented on Jul 1, 2020

    @JeremyWu917

    This problem has bothered developers for almost 20 years, a resolution in the .Net 5 would be welcome...

    https://stackoverflow.com/questions/53000291/how-to-smooth-ugly-jitter-flicker-jumping-when-resizing-windows-especially-drag/53032927

    I have spend one days of my work time to try fixing this unsuccessfully...

    Respect

  7. Malachy-Okwute commented on Jan 29, 2024

    @Malachy-Okwute

    I thought I'm the only one that is having this issue.

  8. phamhieus commented on Jul 12, 2024

    @phamhieus
  9. Safirion commented on Sep 10, 2024

    @Safirion

    No it just moves the flickering to another side of the window

  10. MichaeIDietrich commented on Nov 27, 2024

    @MichaeIDietrich
    Contributor

    For the given example setting NonClientFrameEdges="Right" fixes the flickering. There seems to be no flickering with other sides.
    Can you give an example where other sides are still flickering?

  11. rampaa commented on Mar 15, 2025

    @rampaa

    This is not a .NET Framework bug. I can reproduce it with .NET 9 as well.

  12. phamhieus commented on May 9, 2025

    @phamhieus

    @Safirion Sorry, I answered late. I know, but right edge is significantly less flicker than others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NET FrameworkBug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions