我正在尝试让应用程序具有透明背景,让用户可以看到它后面的内容。我尝试在xaml
文件中更改background
和opacity
参数,但没有任何变化。
我还在背景中设置了一个透明图像。
<Page.Background>
<ImageBrush Stretch="Fill" ImageSource="Assets/fond.png"/>
</Page.Background>
但是它不起作用。
有人知道如何执行这个操作吗?
简述: https://learn.microsoft.com/en-us/windows/uwp/design/style/acrylic
在即将到来的Windows 10更新后,您将能够使用它。
另外,Github上也有相关示例: https://github.com/Microsoft/WindowsUIDevLabs/tree/master/SampleGallery/Samples/SDK%20Insider/BlurPlayground
虽然不是完全透明,但我认为这就是您想要的。
编辑: 我认为它已经在SDK预览版中可用,但我不确定,因为我没有尝试过。
关于Anniversary SDK Preview的信息: https://developer.microsoft.com/en-us/windows/downloads/windows-10-developer-preview
SDK可在此处下载 https://insider.windows.com/
更新:
我刚注意到Compositor类中CreateHostBackdropBrush()函数的预发布。 https://learn.microsoft.com/en-us/uwp/api/windows.ui.composition.compositor
更新:
在Windows 10 Fall Creators Update中,它甚至作为XAML代码提供,非常快速和易于编写。
链接: https://learn.microsoft.com/en-us/windows/uwp/design/style/acrylic