microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.2k stars 669 forks source link

Acrylic Brush doesn't work in combobox #9523

Open WinStack opened 3 months ago

WinStack commented 3 months ago

Describe the bug

I defined a ComboBox and saw that acrylic brush doesn't work in the Popup list of the ComboBox.

Steps to reproduce the bug

  1. Define a ComboBox
  2. See that Acrylic Brush doesn't work in Popup of Items

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.5.1: 1.5.240311000

Windows version

Windows 11 (22H2): Build 22621, Windows 11 (21H2): Build 22000

Additional context

No response

github-actions[bot] commented 3 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

codendone commented 3 months ago

This comes from Composition differences in WinAppSDK. AcrylicBrush is only able to blur other content drawn by WinAppSDK in the same window. For windowed popups (those with ShouldConstrainToRootBounds="false"), which ComboBox uses, the AcrylicBrush can only blur content below it in that popup window. Using Popup.SystemBackdrop can enable acrylic across the window boundary.

It looks Combobox styles attempt to set an acrylic background by using AcrylicBrush (via the ComboBoxDropDownBackground resource). It needs to change to use SystemBackdrop for this to work.

shatyuka commented 2 months ago

@codendone If I use SystemBackdrop in ComboBox style, it will show a transparent background. Any idea?

<StaticResource x:Key="ComboBoxDropDownBackground" ResourceKey="DesktopAcrylicTransparentBrush" />
<Popup x:Name="Popup"
       SystemBackdrop="{StaticResource AcrylicBackgroundFillColorDefaultBackdrop}"
       Grid.Row="0"
       Grid.Column="0">
gegao18 commented 1 hour ago

@shatyuka You'll need to specify ShouldConstrainToRootBounds="False" on that popup as well. That will allow the popup to escape the bounds of its island (e.g. the ComboBox dropdown can go outside the window bounds), and lets the SystemBackdrop render desktop acrylic.