Search code examples
xamluwpuwp-xamlwindows-community-toolkit

UWPCommunityToolkit DropShadowPanel on Button


I'm trying to apply a shadow effect on a button on a UWP application.

I'm using the UWPCommunityToolkit tool and the control DropShadowPanel. Here an example :

http://www.uwpcommunitytoolkit.com/en/master/controls/DropShadowPanel/

So my code for apply on a button control :

<controls:DropShadowPanel BlurRadius="{Binding BlurRadius.Value, Mode=OneWay}"
                              ShadowOpacity="{Binding Opacity.Value, Mode=OneWay}"
                              OffsetX="{Binding OffsetX.Value, Mode=OneWay}"
                              OffsetY="{Binding OffsetY.Value, Mode=OneWay}"
                              VerticalAlignment="Center"
                              HorizontalAlignment="Center">
    <Button Content="My button" />
</controls:DropShadowPanel>

But the result is :

enter image description here

The shadow cover all my button control.

According to the doc Button control doesn't directy inherit from FrameworkElement, that is maybe a reason.

Regards


Solution

  • Hum problem solved by using custom values :

    <controls:DropShadowPanel BlurRadius="4.0"
                                  ShadowOpacity="0.70"
                                  OffsetX="5.0"
                                  OffsetY="5.0"
                                  Color="Black"
                                  VerticalAlignment="Center"
                                  HorizontalAlignment="Center">
            <Button Content="My button" Background="Aqua" />
        </controls:DropShadowPanel>
    

    enter image description here