I am trying to build a Windows 11 application with a transparent window. I achieved a transparent window by setting AllowsTransparency=True and WindowStyle=None. But when i resize to left there is flickering. There are similar questions in Stackoverflow related to flickering issues. Most of them are for win32 or not a proper solution given or some APIs may not supported now. I understand it is a Windows framework limitation by itself. So, I tried to use windowchrome property. I set NonClientFrameEdges= Left in windowchrome property. It works for Windows 10. There is no flickering in Windows 10. But in Windows 11 there is transparency fully gone there is a white background that comes in. This problem even exists in WinUI3.
I think it is quite noticeable and not a good experience as a user. Is there any way to reduce or remove this flickering?
I already go through these questions,
Flickering on window when resizing from left side questions
How to smooth ugly jitter/flicker/jumping when resizing windows, especially dragging left/top border (Win 7-10; bg, bitblt and DWM)?
https://github.com/microsoft/microsoft-ui-xaml/issues/5148
I am expecting a WPF transparent window without flickering on resize to the left. I am using .net8.
I create a WPF project. Project Here is the code example of MainWindow.xaml:
<Window x:Class="BlurWindow.MainWindow"
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"
xmlns:local="clr-namespace:BlurWindow"
mc:Ignorable="d"
AllowsTransparency="True"
WindowStyle="None"
Background="#1f010100"
BorderBrush="White"
BorderThickness="2"
Title="MainWindow" Height="450" Width="800">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="32"/>
</WindowChrome.WindowChrome>
<Border x:Name="MainWindowBorder" Background="Transparent">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Background="White" Grid.Row="0">
<StackPanel
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock FontFamily="Arial"
Text="Sample App"/>
</StackPanel>
</Grid>
</Grid>
</Border>
</Window>
Akram is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.