Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xaml UWP中的半透明背景_Xaml_Windows Phone 8_Uwp_Background Color_Uwp Xaml - Fatal编程技术网

Xaml UWP中的半透明背景

Xaml UWP中的半透明背景,xaml,windows-phone-8,uwp,background-color,uwp-xaml,Xaml,Windows Phone 8,Uwp,Background Color,Uwp Xaml,我想在列表框中使用半透明背景 我使用的是Background=“{StaticResource phone semipransparentbrush}” 在WindowsPhone8应用程序中。 但这种半透明画笔在UWP中不可用,UWP中相同半透明背景的任何替代画笔?您可以从SystemControlBackgroundAltMediumBrush获得的壁橱可能是使用SystemAltMediumColor的,它的alpha通道为60%,而手机画笔的alpha通道为66.7%。方法1: 设置背景

我想在列表框中使用半透明背景 我使用的是
Background=“{StaticResource phone semipransparentbrush}”
在WindowsPhone8应用程序中。
但这种半透明画笔在UWP中不可用,UWP中相同半透明背景的任何替代画笔?

您可以从
SystemControlBackgroundAltMediumBrush
获得的壁橱可能是使用
SystemAltMediumColor
的,它的alpha通道为60%,而手机画笔的alpha通道为66.7%。

方法1: 设置背景色的
不透明度

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

方法2: 通过为背景色设置Alpha通道

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

可以在“属性”面板中使用Alpha通道选择颜色


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

为什么你不能创建自己的资源呢?如果您想要一个系统定义的,请检查我的答案,您真的应该使用meresource来代替。在我的例子中,我只使用白色,不透明度为0.55。谢谢谢谢,您的回答也帮助meSystemControlBackgroundAltMediumLowBrush工作完美,非常类似于windows phone 8半透明刷