Boogaart.Silverlight.Behaviors.Popup.PopupWatcher.OnMouseLeftButtonDown C# (CSharp) Method

OnMouseLeftButtonDown() private method

private OnMouseLeftButtonDown ( object sender, System.Windows.Input.MouseButtonEventArgs e ) : void
sender object
e System.Windows.Input.MouseButtonEventArgs
return void
            private void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
            {
                // in lieu of DependencyObject.SetCurrentValue, this is the easiest way to enact a change on the value of the Popup's IsOpen
                // property without overwriting any binding that may exist on it
                var storyboard = new Storyboard() { Duration = TimeSpan.Zero };
                var objectAnimation = new ObjectAnimationUsingKeyFrames() { Duration = TimeSpan.Zero };
                objectAnimation.KeyFrames.Add(new DiscreteObjectKeyFrame() { KeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero), Value = false });
                Storyboard.SetTarget(objectAnimation, this.popup);
                Storyboard.SetTargetProperty(objectAnimation, new PropertyPath("IsOpen"));
                storyboard.Children.Add(objectAnimation);
                storyboard.Begin();
            }
        }