UWP 中的半透明背景



我想在列表框中使用半透明背景 我正在使用Background="{StaticResource PhoneSemitransparentBrush}"在 Windows Phone 8 应用程序中。 但是这个半透明画笔在 UWP 中不可用,在 UWP 中是否有用于相同半透明背景的替代画笔?

方法 1:

设置背景颜色的Opacity

<ListView>
<ListView.Background>
<SolidColorBrush Color="Red" Opacity="0.5"/>
</ListView.Background>
</ListView>

方法2:

通过为背景颜色设置 Alpha 通道

<ListView Background="#7FFF0000"/>

您可以在属性面板中选择带有 Alpha 通道的颜色

"属性"面板> 画笔>背景>纯色画笔> 您可以通过设置A来设置透明度。

你可以得到的壁橱可能来自使用SystemAltMediumColorSystemControlBackgroundAltMediumBrush,它的alpha通道为60%,而手机刷的alpha通道为66.7%。

最新更新