WebExpress.AddBookmark.ExecuteStoryboard C# (CSharp) Method

ExecuteStoryboard() public method

public ExecuteStoryboard ( ) : void
return void
        public void ExecuteStoryboard()
        {
            try
            {
                StaticFunctions.AnimateScale(260, 178, 0, 0, this, 0.2);
                var fade = new DoubleAnimation
                {
                    From = 1,
                    To = 0,
                    Duration = TimeSpan.FromSeconds(0.3)
                };
                Storyboard.SetTarget(fade, this);
                Storyboard.SetTargetProperty(fade, new PropertyPath(UIElement.OpacityProperty));

                var sb = new Storyboard();
                sb.Children.Add(fade);
                sb.Begin();

                sb.Completed +=
                    (o, e1) =>
                    {
                        var parent = Parent as Grid;
                        parent.Children.Remove(this);
                    };
                sb.Begin();
            } catch { }
        }