文档:https://docs.microsoft.com/en-us/windows/uwp/design/style/acrylicwindows
Acrylic 能带来相似 win7 的毛玻璃效果app
要使用 Acrylic ,须要 win10 的版本最低为 1709 ,在模拟器中是 16299spa
Acrylic 有两种:code
顾名思义,一种是应用背景用的,一种是应用中弹出遮罩层之类用的blog
win10 带了不少 acrylic resources ,能够直接使用ci
好比 Background acrylic 的:文档
SystemControlAcrylicWindowBrush,
SystemControlChromeLowAcrylicWindowBrush,
SystemControlBaseHighAcrylicWindowBrush,
SystemControlBaseLowAcrylicWindowBrush,
SystemControlAltHighAcrylicWindowBrush,
SystemControlAltLowAcrylicWindowBrush get
In-app acrylic 须要用:it
SystemControlAcrylicElementBrush ,
SystemControlChromeLowAcrylicElementBrush ,
SystemControlBaseHighAcrylicElementBrush ,
SystemControlBaseLowAcrylicElementBrush ,
SystemControlAltHighAcrylicElementBrush ,
SystemControlAltLowAcrylicElementBrush io
简单效果以下:
固然,除了用自带的 resources ,咱们也能够自定义 acrylic
自定义 AcrylicBrush 能够设置4个属性:
而后很愉快的写了下:
<Grid.Background> <AcrylicBrush BackgroundSource="HostBackdrop" TintColor="#FFFF0000" Opacity="0.6" FallbackColor="Black" ></AcrylicBrush> </Grid.Background>
运行发现木有效果…
而后尝试写成 Resource :
<Page.Resources> <AcrylicBrush x:Key="MyAcrylicBrush" BackgroundSource="HostBackdrop" TintColor="#FFFF0000" TintOpacity="0.6" TintTransitionDuration="1" FallbackColor="Black"/> </Page.Resources> <Grid Background="{StaticResource MyAcrylicBrush}"> </Grid>
效果以下:
因此若是直接写 AcrylicBrush 没效果的
能够尝试写个 Resource 再试试…