【问题标题】:Drop shadow on background color背景颜色上的阴影
【发布时间】:2013-08-27 00:15:07
【问题描述】:

我正在尝试在 wpf 数据网格行背景颜色上添加阴影
我尝试的是设置数据网格行样式,但我有点卡在那里
我可以将背景属性设置为某种颜色甚至是渐变颜色,但我似乎无法在该颜色上投下阴影
我正在尝试使行背景不那么平坦

<Style TargetType="DataGridRow">
    <Setter Property="Background" Value="....." />

【问题讨论】:

  • 你能给我们一张你想要完成的图片吗?
  • 类似这样的东西:link 但只有网格行,我的行颜色是一个绑定属性,所以我需要阴影落在行的任何颜色上

标签: wpf xaml colors


【解决方案1】:

这很好用:

<DataGrid.RowStyle>
    <Style TargetType="DataGridRow">
        <Setter Property="Background">
            <Setter.Value>
                <SolidColorBrush Color="{Binding color}"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Effect">
            <Setter.Value>
                <DropShadowEffect BlurRadius="50" Color="{Binding color}"/>
            </Setter.Value>
        </Setter>
    </Style>
</DataGrid.RowStyle>

虽然我不知道你想要完成什么;每行的阴影相互融合并遮盖了行文本:-/

【讨论】:

    猜你喜欢
    • 2016-11-28
    • 1970-01-01
    • 1970-01-01
    • 2012-10-07
    • 2017-05-17
    • 2023-03-21
    • 1970-01-01
    • 1970-01-01
    • 2013-07-26
    相关资源
    最近更新 更多