In this article, I will write about Increase the Shadow Depth of a button control in Silverlight 6 when you clicked in a Silverlight app. As usual, open the visual studio and choose the Silverlight project. First allow us to drag a button from toolbox as shown below into MainPage.xaml.

Now, i'm about to write a button click event for this button. It means, we are able to see the animation impact once ever button is clicked.
<Button Content="ClickHere" Click="StartAnimation" Width="200" Margin="60">
        <Button.Effect>
            <DropShadowEffect x:Name="myDropShadowEffect" />
        </Button.Effect>          
</Button>

Now allow us to produce a storyboard as shown below. From the below code we will able to notice that the target name and the name of our button are same. ShadowDepth is assigned because the target property.
<Storyboard x:Name="myStoryboard">
                <DoubleAnimation
                Storyboard.TargetName="myDropShadowEffect"
                Storyboard.TargetProperty="ShadowDepth"
                To="30" Duration="0:0:0.5"
                AutoReverse="True" />
            </Storyboard>

We will write the storyboard begin method within the event "StartAnimation" in MainPage.xaml.cs as shown below.
private void StartAnimation(object sender, RoutedEventArgs args)
        {
            myStoryboard.Begin();
        }

And here is the code that I used:

MainPage.Xaml
<UserControl x:Class="SilverlightTest1.MainPage"
    xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
    xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
    xmlns:d=http://schemas.microsoft.com/expression/blend/2008
    xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
     <StackPanel>
         <StackPanel.Resources>
            <Storyboard x:Name="myStoryboard">
                <DoubleAnimation
                Storyboard.TargetName="myDropShadowEffect"
                Storyboard.TargetProperty="ShadowDepth"
                To="30" Duration="0:0:0.5"
                AutoReverse="True" />
            </Storyboard>
        </StackPanel.Resources>
        <Button Content="Click Here" Click="StartAnimation" Width="200"
            Margin="60">
            <Button.Effect>
                <DropShadowEffect x:Name="myDropShadowEffect" />
           </Button.Effect>         
        </Button>
    </StackPanel>
</UserControl>


MainPage.Xaml.cs
private void StartAnimation(object sender, RoutedEventArgs args)
        {
            myStoryboard.Begin();
        }

HostForLIFE.eu Silverlight 6 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.