ComponentFactory.Krypton.Docking.KryptonAutoHiddenSlidePanel.SlideOut C# (CSharp) Method

SlideOut() public method

Requests the panel slide into view and display the provided page.
public SlideOut ( KryptonPage page, KryptonAutoHiddenGroup group, bool select ) : void
page ComponentFactory.Krypton.Navigator.KryptonPage Reference to page for display.
group KryptonAutoHiddenGroup Reference to auto hidden group that displays the page.
select bool Should the sliding out page become selected.
return void
        public void SlideOut(KryptonPage page, KryptonAutoHiddenGroup group, bool select)
        {
            // Check to see if we allowed to perform operations
            if (Disposing || IsDisposed)
                return;

            // Move to the hidden state
            switch (_state)
            {
                case DockingAutoHiddenShowState.Hidden:
                    // Nothing to do, already in state we require
                    break;
                case DockingAutoHiddenShowState.SlidingIn:
                    // If already showing indicated page (although currently sliding inwards)
                    if (page == _page)
                    {
                        // Switch to sliding out again
                        _state = DockingAutoHiddenShowState.SlidingOut;

                        // Are we requested to set focus to the sliding in dockspace?
                        if (select)
                        {
                            DockspaceControl.Select();
                            DockspaceControl.CellLosesFocus += new EventHandler<WorkspaceCellEventArgs>(OnDockspaceCellLosesFocus);
                        }
                        return;
                    }
                    else
                    {
                        // Different page, so move straight to hidden state
                        MakeHidden();
                    }
                    break;
                case DockingAutoHiddenShowState.SlidingOut:
                case DockingAutoHiddenShowState.Showing:
                    // If already showing indicated page (or in the process of showing) then do nothing
                    if (page == _page)
                    {
                        // Are we requested to set focus to the sliding in dockspace?
                        if (select)
                        {
                            DockspaceControl.Select();
                            DockspaceControl.CellLosesFocus += new EventHandler<WorkspaceCellEventArgs>(OnDockspaceCellLosesFocus);
                        }
                        return;
                    }
                    else
                    {
                        // Different page, so move straight to hidden state
                        MakeHidden();
                    }
                    break;
            }

            // Cache information about the page being displayed
            _page = page;
            _group = group;

            // Make sure we have a visible cell to update
            KryptonWorkspaceCell cell = DockspaceControl.FirstVisibleCell();
            if (cell == null)
            {
                cell = new KryptonWorkspaceCell();
                DockspaceControl.Root.Children.Add(cell);
            }

            // Replace any existing page with the new one
            DockspaceControl.ClearAllPages();
            cell.Pages.Add(page);
            DockspaceControl.PerformLayout();

            // Find the starting and ending rectangles for the slide operation
            CalculateStartAndEnd();

            // Set initial positions of ourself and the contained inner panel
            _inner.SetBounds(0, 0, _endRect.Width, _endRect.Height);
            SetBounds(_startRect.X, _startRect.Y, _startRect.Width, _startRect.Height);

            // Make sure we are at the top of the z-order and visible
            _control.Controls.SetChildIndex(this, 0);
            Visible = true;

            // Switch to new state and start animation timer
            _state = DockingAutoHiddenShowState.SlidingOut;
            AutoHiddenShowingStateEventArgs args = new AutoHiddenShowingStateEventArgs(_page, _state);
            _slideTimer.Start();

            // Are we requested to set focus to the sliding in dockspace?
            if (select)
            {
                DockspaceControl.Select();
                DockspaceControl.CellLosesFocus += new EventHandler<WorkspaceCellEventArgs>(OnDockspaceCellLosesFocus);
            }

            // Raises event to indicate change in auto hidden showing state
            OnAutoHiddenShowingStateChanged(args);
        }

Usage Example

 /// <summary>
 /// Slide the specified page into view and optionally select.
 /// </summary>
 /// <param name="uniqueName">Name of page to slide into view.</param>
 /// <param name="select">True to select the page; otherwise false.</param>
 public void SlidePageOut(string uniqueName, bool select)
 {
     // Search each of our AutoHiddenGroup entries
     for (int i = 0; i < Count; i++)
     {
         KryptonDockingAutoHiddenGroup ahg = this[i] as KryptonDockingAutoHiddenGroup;
         // If the target page is inside this group
         KryptonPage page = ahg?.AutoHiddenGroupControl.Pages[uniqueName];
         if (page != null)
         {
             // Request the sliding panel slide itself into view with the provided page
             KryptonAutoHiddenProxyPage proxyPage = (KryptonAutoHiddenProxyPage)page;
             _slidePanel.SlideOut(proxyPage.Page, ahg.AutoHiddenGroupControl, @select);
             break;
         }
     }
 }