【问题标题】:WPF - grid with opacity and shadowWPF - 具有不透明度和阴影的网格
【发布时间】:2016-11-01 07:29:56
【问题描述】:

我想创建带有白色不透明背景和外阴影的网格。我的代码创建了具有白色背景和阴影的网格,但没有不透明度:

<Border Margin="20" BorderBrush="DarkGray" BorderThickness="1" CornerRadius="4"
    Background="{x:Static SystemColors.ControlLightLightBrush}">
    <Border.Effect>
        <DropShadowEffect/>
    </Border.Effect>
    <Grid>
        <Grid.Resources>
            <Style TargetType="{x:Type Grid}">
                <Setter Property="Background">
                    <Setter.Value>
                        <SolidColorBrush Color="#fff" Opacity="0.5" />
                    </Setter.Value>
                </Setter>
            </Style>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"></ColumnDefinition>
            <ColumnDefinition Width="1*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="2*"></RowDefinition>
        </Grid.RowDefinitions>
    </Grid>
</Border>

如何创建带有白色不透明背景和外阴影的网格? 感谢您的建议。

【问题讨论】:

  • ControlLightLightBrush 几乎是白色的。白色网格与白色封面?如果不是半透明的话,差别不大。选择另一个边框背景并查看结果

标签: .net wpf


【解决方案1】:

尝试使用单词white 而不是#fff 作为背景颜色。我不认为这是一个格式良好的 RGB 值。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-02-13
    • 2012-07-17
    • 2012-01-29
    • 2013-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多