Answer the question
In order to leave comments, you need to log in
WPF How to get rid of window flicker?
Hello, please help me figure it out :)
Done: changed the style of the window.
Got it: When resizing, the window starts flickering. It flickers on Win 7. I did not notice this in Win 10.
If you set the AllowsTransparency="True" property, the flickering disappears, but this property does not suit you (CPU consumption increases significantly), it must be FALSE.
I see two options
Answer the question
In order to leave comments, you need to log in
There are a few bugs in the style code
1) don't use extra borders creating unnecessary tree branches
<!--Back border-->
<Border x:Name="BackBorder"
Background="LightGray">
</Border>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Window}">
<Border x:Name="RootContainer" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
<AdornerDecorator>
<DockPanel>
<Border DockPanel.Dock="Top" Background="{StaticResource WindowHeaderBackgroundBrush}">
<!--тут ваши стили заголовка и его элементов-->
</Border>
<ContentPresenter/>
</DockPanel>
</AdornerDecorator>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="WindowState" Value="Maximized">
<Setter TargetName="RootContainer" Property="Padding" Value="7"/>
</Trigger>
<Trigger Property="IsActive" Value="False">
<Setter TargetName="RootContainer" Property="BorderBrush" Value="#FF333333"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question