Exemplo n.º 1
0
        /// <summary>
        /// Hide temporay pane and reset current docking button
        /// </summary>
        /// <param name="smooth">True if resize animation is enabled</param>
        private void HideTempPane(bool smooth)
        {
            if (_tempPane != null)
            {
                DockablePane pane       = gridDocking.GetPaneFromContent(_tempPane.Contents[0]) as DockablePane;
                bool         right_left = false;
                double       length     = 0.0;

                switch (_currentButton.DockingButtonGroup.Dock)
                {
                case Dock.Left:
                case Dock.Right:
                    if (_tempPaneAnimation != null)
                    {
                        pane.PaneWidth = _lengthAnimation;
                    }
                    else
                    {
                        pane.PaneWidth = _tempPane.Width;
                    }
                    length     = _tempPane.Width;
                    right_left = true;
                    break;

                case Dock.Top:
                case Dock.Bottom:
                    if (_tempPaneAnimation != null)
                    {
                        pane.PaneHeight = _lengthAnimation;
                    }
                    else
                    {
                        pane.PaneHeight = _tempPane.Height;
                    }
                    length     = _tempPane.Height;
                    right_left = false;
                    break;
                }

                _tempPane.OnStateChanged -= new EventHandler(_tempPane_OnStateChanged);

                if (smooth)
                {
                    HideOverlayPanel(length, right_left);
                }
                else
                {
                    ForceHideOverlayPanel();
                    panelFront.BeginAnimation(DockPanel.OpacityProperty, null);
                    panelFront.Children.Clear();
                    panelFront.Opacity = 0.0;
                    _tempPane.Close();
                }

                _currentButton = null;
                _tempPane      = null;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Forces to hide current overlay panel
        /// </summary>
        /// <remarks>Usually used when a second animation is about to start from a different button</remarks>
        void ForceHideOverlayPanel()
        {
            if (_tempPaneAnimation != null)
            {
                _animation.Completed -= new EventHandler(HideOverlayPanel_Completed);
                _animation.Completed -= new EventHandler(ShowOverlayPanel_Completed);
                if (_leftRightAnimation)
                {
                    _tempPaneAnimation.BeginAnimation(FrameworkElement.WidthProperty, null);
                    //_tempPaneAnimation.Width = 0;
                }
                else
                {
                    _tempPaneAnimation.BeginAnimation(FrameworkElement.HeightProperty, null);
                    //_tempPaneAnimation.Height = 0;
                }

                _tempPaneAnimation.Close();
                _tempPaneAnimation = null;
            }
        }