-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<Window x:Class="animfromcodebehindWpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
	<Window.Resources>
		<Storyboard x:Key="Storyboard1">
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="rectangle1">
				<EasingDoubleKeyFrame KeyTime="0:0:1" Value="-36"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="rectangle1">
				<EasingDoubleKeyFrame KeyTime="0:0:1" Value="-46"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="rectangle1">
				<EasingDoubleKeyFrame KeyTime="0:0:1" Value="359.484"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
	</Window.Resources>
	<Window.Triggers>
		<EventTrigger RoutedEvent="FrameworkElement.Loaded">
			<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
		</EventTrigger>
	</Window.Triggers>
    <Grid>
        <Rectangle Height="100" HorizontalAlignment="Left" Margin="84,82,0,0" Name="rectangle1" Stroke="Black" VerticalAlignment="Top" Width="200" Fill="#FDFFFF0D" RenderTransformOrigin="0.5,0.5" >
        	<Rectangle.RenderTransform>
        		<TransformGroup>
        			<ScaleTransform/>
        			<SkewTransform/>
        			<RotateTransform/>
        			<TranslateTransform/>
        		</TransformGroup>
        	</Rectangle.RenderTransform>
        </Rectangle>
        <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="344,72,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
    </Grid>
   
</Window>
 
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
In the  code behind I have writtenI call this function on button click event.
When I click the button nothing happens.
Please help.