DropShadowPanel和边框角半径

DropShadowPanel和边框角半径

本文介绍了DropShadowPanel和边框角半径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过边框控制来制作阴影效果.我正在使用UWP工具包.

I want to make drop shadow effect with border control. I am using UWP toolkit.

<controls:DropShadowPanel x:Name="dspShadow"
                          BlurRadius="10"
                          ShadowOpacity="0.8"
                          OffsetX="0"
                          OffsetY="0"
                          Color="Black">
    <Border x:Name="borderMain" Background="Red" CornerRadius="10"/>
</controls:DropShadowPanel>

但是它不能识别拐角半径,结果是这样的:

But it doesn't recognize corner radius, the result is like this:

我需要它看起来像这样:

And I need it to look like this:

有什么想法可以实现这一目标吗?

Any ideas how to achieve this?

推荐答案

您需要屏蔽它.当前,您只能从TextBlockShapeImage获取掩码.在这种情况下,只需将Border替换为Rectangle.

You need to mask it. Currently you can only get the mask from TextBlock, Shape and Image. In this case just replace the Border with a Rectangle.

<controls:DropShadowPanel x:Name="dspShadow"
                          BlurRadius="10"
                          OffsetX="0"
                          OffsetY="0"
                          ShadowOpacity="0.8"
                          Color="Black">
    <Rectangle Width="100"
               Height="48"
               Fill="Red"
               RadiusX="10"
               RadiusY="10" />
</controls:DropShadowPanel>

这篇关于DropShadowPanel和边框角半径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 23:46