FluentWPF
FluentWPF copied to clipboard
Fluent Design in Windows 11
FluentWPF has some problems in Windows 11.
- Acrylic Effect doesn't work properly.
- MICA material haven't supported yet.
- https://docs.microsoft.com/en-us/windows/apps/design/style/mica
Please comment in this issue about Fluent Design in Windows 11.
Rollback to version 0.9 and everything work fine, included:
- Animation of the maximized window to normal window.
- Animation of the normal window to maximized window.
- Animation of the minimized window to maximized / normal window.
- Animation of the maximized / normal window to minimized window.
- Acrylic screen.
- DragMove.
- MinHeight and MinWidth
Works well on Windows 11.
Facts:

without page

with the page (attention title bar)
Does ACRYLICBLURBEHIND not work at all on Windows 11? Any way to fix this?
When using Fluent Wpf with MahApps, there was a lag when moving the semi-transparent window, but when using Fluent WPF with Modern WPF, it worked without any problems.
Actually found an easy way to apply Mica to a window in WPF:
PS it also supports snap grids:

public enum WindowsTheme
{
Light,
Dark
}
public class ThemeHelper
{
private const string _registryKeyPath = @"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize";
private const string _registryValueName = "AppsUseLightTheme";
public static WindowsTheme GetWindowsTheme()
{
using RegistryKey? key = Registry.CurrentUser.OpenSubKey(_registryKeyPath);
object? registryValueObject = key?.GetValue(_registryValueName);
if (registryValueObject == null)
{
return WindowsTheme.Light;
}
int registryValue = (int)registryValueObject;
return registryValue > 0 ? WindowsTheme.Light : WindowsTheme.Dark;
}
}
public static class MicaHelper
{
[DllImport("dwmapi.dll")]
private static extern int DwmSetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute, ref int pvAttribute, int cbAttribute);
[Flags]
private enum DwmWindowAttribute : uint
{
DWMWA_USE_IMMERSIVE_DARK_MODE = 20,
DWMWA_MICA_EFFECT = 1029
}
public static void UpdateStyleAttributes(this Window window)
{
IntPtr windowHandle = new WindowInteropHelper(window).Handle;
var darkThemeEnabled = ThemeHelper.GetWindowsTheme();
int trueValue = 0x01;
int falseValue = 0x00;
if (darkThemeEnabled == WindowsTheme.Dark)
{
_ = DwmSetWindowAttribute(windowHandle, DwmWindowAttribute.DWMWA_USE_IMMERSIVE_DARK_MODE, ref trueValue, Marshal.SizeOf(typeof(int)));
}
else
{
_ = DwmSetWindowAttribute(windowHandle, DwmWindowAttribute.DWMWA_USE_IMMERSIVE_DARK_MODE, ref falseValue, Marshal.SizeOf(typeof(int)));
}
_ = DwmSetWindowAttribute(windowHandle, DwmWindowAttribute.DWMWA_MICA_EFFECT, ref trueValue, Marshal.SizeOf(typeof(int)));
}
}
Usage: Window code behind:
public MainWindow()
{
this.UpdateStyleAttributes();
}
Window Xaml:
<Window x:Class="WpfTest01.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:WpfTest01"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800"
Background="Transparent">
<WindowChrome.WindowChrome>
<WindowChrome
CaptionHeight="20"
ResizeBorderThickness="8"
CornerRadius="0"
GlassFrameThickness="-1"
UseAeroCaptionButtons="True" />
</WindowChrome.WindowChrome>
<Grid>
</Grid>
</Window>
2021年10月15日(金) 22:12 Ricky @.***>:
Roll back to version 0.9 and everything work fine, included:
- Animation of maximization, normalization.
- Acrylic screen.
- DragMove.
- MinHeight and MinWidth Works well on Windows 11.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sourcechord/FluentWPF/issues/130#issuecomment-944286863, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRDPXHBYKLYFGRYDXUMWX3UHASCXANCNFSM5B5FJWLQ .
same issue
I was able to get an ACRYLICBLURBEHIND working under Windows 11 by not setting accent.AccentFlags = 2 and by setting the WindowStyle="None" along with fw:AcrylicWindow.AllowsTransparency="True". Here is a branch with a modified sample app with the working Acrylic window: https://github.com/cfoucher/FluentWPF/tree/win11_acrylicBlur

Roll back to version 0.9, and acrylic effect can work normally. However, there are some problems, such as dragging the window slowly and window flashing when dragging the window.
ACRYLICBLURBEHIND is working just fine on Windows 11. I was able to make acrylic menu/popup with it.

The only disadvantage is that there are no fancy slide animations on popup opening. They just do not work :(
@sourcechord can you update?