Ejemplo n.º 1
0
        /// <summary>
        /// Maximises a panel.
        /// </summary>
        /// <param name="sender">the panel to maximise.</param>
        /// <param name="e">Event args.</param>
        private void DragDockPanel_Maximized(object sender, EventArgs e)
        {
            DragDockPanel maximizedPanel =
                sender as DragDockPanel;

            // Store max'ed panel
            this.maximizedPanel = maximizedPanel;

            // Loop through children to disable dragging
            foreach (UIElement child in this.panels)
            {
                DragDockPanel panel =
                    child as DragDockPanel;

                panel.DraggingEnabled = false;

                if (panel != this.maximizedPanel)
                {
                    panel.Minimize();
                }
            }

            // Update sizes and layout
            this.AnimatePanelSizes();
            this.AnimatePanelLayout();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Puts all of the panel back to a grid view.
        /// </summary>
        /// <param name="sender">The minimising panel.</param>
        /// <param name="e">Event args.</param>
        private void DragDockPanel_Restored(object sender, EventArgs e)
        {
            // Set max'ed panel to null
            this.maximizedPanel = null;

            // Loop through children to disable dragging
            foreach (UIElement child in this.panels)
            {
                DragDockPanel panel =
                    child as DragDockPanel;
                panel.Restore();
                panel.DraggingEnabled = true;
            }

            // Update sizes and layout
            this.AnimatePanelSizes();
            this.AnimatePanelLayout();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Drops the dragging panel.
        /// </summary>
        /// <param name="sender">The dragging panel.</param>
        /// <param name="args">Drag event args.</param>
        private void DragDockPanel_DragFinished(object sender, DragEventArgs args)
        {
            // Set dragging panel back to null
            this.draggingPanel = null;

            // Update the layout (to reset all panel positions)
            this.UpdatePanelLayout();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Keeps a reference to the dragging panel.
        /// </summary>
        /// <param name="sender">The dragging panel.</param>
        /// <param name="args">Drag event args.</param>
        private void DragDockPanel_DragStarted(object sender, DragEventArgs args)
        {
            DragDockPanel panel = sender as DragDockPanel;

            // Keep reference to dragging panel
            this.draggingPanel = panel;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Unprepares a panel for the UI. Override for hooking custom events.
        /// </summary>
        /// <param name="panel">The panel to prepare.</param>
        protected virtual void UnpreparePanel(DragDockPanel panel)
        {
            if (panel.PanelState == PanelState.Maximized)
            {
                this.DragDockPanel_Restored(null, null);
            }

            // Hook up panel events
            panel.DragStarted -=
                new DragEventHander(this.DragDockPanel_DragStarted);
            panel.DragFinished -=
                new DragEventHander(this.DragDockPanel_DragFinished);
            panel.DragMoved -=
                new DragEventHander(this.DragDockPanel_DragMoved);
            panel.Maximized -=
                new EventHandler(this.DragDockPanel_Maximized);
            panel.Restored -=
                new EventHandler(this.DragDockPanel_Restored);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Prepares a panel for the UI. Override for hooking custom events.
        /// </summary>
        /// <param name="panel">The panel to prepare.</param>
        protected virtual void PreparePanel(DragDockPanel panel)
        {
            // Hook up panel events
            panel.DragStarted +=
                new DragEventHander(this.DragDockPanel_DragStarted);
            panel.DragFinished +=
                new DragEventHander(this.DragDockPanel_DragFinished);
            panel.DragMoved +=
                new DragEventHander(this.DragDockPanel_DragMoved);
            panel.Maximized +=
                new EventHandler(this.DragDockPanel_Maximized);
            panel.Restored +=
                new EventHandler(this.DragDockPanel_Restored);

            if (panel.PanelState == PanelState.Maximized)
            {
                this.maximizedPanel = panel;

                foreach (DragDockPanel dragDockPanel in this.panels)
                {
                    if (panel != dragDockPanel)
                    {
                        dragDockPanel.Minimize();
                    }
                }
            }
        }