DropShadowPanel and border corner radius

淺唱寂寞╮ 提交于 2020-01-04 09:05:33

问题


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?


回答1:


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>


来源:https://stackoverflow.com/questions/45211031/dropshadowpanel-and-border-corner-radius

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!