how to get the stroy board current value in wpf double animation

Nov 4 2010 7:42 AM
hi,
this is koti well i think well known to many users of this site as koteswararao mallisetti here the issue is  i am start the one double animation in one button click event it's work file when i stop the animation with another button clik event the animation object get into the original state not in the present state how can we get the current value of the animated object property in the second button click event how to get the current value of that animated object
this is my xaml code:
<Canvas Height="282" Width="286">
        <Ellipse  Width="20" Height="20" Fill="Blue" Canvas.Left="75" Panel.ZIndex="1" Canvas.Top="12" Name="circ"></Ellipse>
        
        <Rectangle Height="258" Width="164" Fill="Beige" Canvas.Left="12" Canvas.Top="12" Stroke="Brown">
            
        </Rectangle>
        <Button Canvas.Left="199" Canvas.Top="85" Height="23" Name="BtnDrop" Width="75" Click="BtnDrop_Click">Start</Button>
        <Button Canvas.Left="199" Canvas.Top="136" Height="23" Name="BtnStop" Width="75" Click="BtnStop_Click">Stop</Button>
    </Canvas>
.cs file
Storyboard sb = new Storyboard();
        public Window1()
        {
            InitializeComponent();
        }

        private void BtnDrop_Click(object sender, RoutedEventArgs e)
        {
           DoubleAnimation  drop = new DoubleAnimation(247, new Duration(new TimeSpan(0, 0, 10)));
           drop.To = 247;
           Storyboard.SetTarget(drop, circ);
           Storyboard.SetTargetProperty(drop, new PropertyPath(Canvas.TopProperty));
           //Storyboard.SetTargetName(drop,circ.Name );
          
            sb.Children.Add(drop);
           sb.Begin();
            //sb.BeginAnimation(Canvas.TopProperty , drop);          
            //circ.BeginAnimation(Canvas.TopProperty, drop);
          
        }

        private void BtnStop_Click(object sender, RoutedEventArgs e)
        {
            Canvas.SetTop(circ,Convert.ToDouble(sb.GetValue(Canvas.TopProperty)));
            sb.Stop();
           
        }
}