/// <summary>
        /// Closes the modal dialog.
        /// </summary>
        public void Close()
        {
            if (_isOpen)
            {
                ValidateOwner();

                InlineModalDecorator panel = GetModalDecorator(Owner);

                if (panel != null)
                {
                    var cancelArgs = new CancelRoutedEventArgs(ClosingEvent);
                    OnClosing(cancelArgs);
                    if (!cancelArgs.Cancel)
                    {
                        if (AnimatorService.IsAnimationEnabled)
                        {
                            Storyboard dialogAnim = DialogOutroAnimation;
                            if (dialogAnim != null)
                            {
                                if (dialogAnim.IsFrozen)
                                {
                                    dialogAnim = dialogAnim.Clone();
                                }

                                // Add a handler so we know when the dialog can be closed.
                                dialogAnim.AttachCompletedEventHandler(OnCloseAnimationCompleted);
                                dialogAnim.Begin(this);
                            }
                        }
                        else
                        {
                            CloseDialog(panel);
                        }
                    }
                }
            }
        }
 /// <summary>
 /// Raises the <see cref="Closing"/> routed event.
 /// </summary>
 /// <param name="args"></param>
 protected virtual void OnClosing(CancelRoutedEventArgs args)
 {
     RaiseEvent(args);
 }