Пример #1
0
 private void titleBar_WindowAction(object sender, WindowActionEventArgs args)
 {
     if (args.Action == WindowAction.Close)
     {
         Close();
     }
     else if (args.Action == WindowAction.Maximize)
     {
         WindowState = (WindowState == WindowState.Normal) ? WindowState.Maximized : WindowState.Normal;
     }
     else if (args.Action == WindowAction.Minimize)
     {
         WindowState = WindowState.Minimized;
     }
     args.Handled = true;
 }
Пример #2
0
        private void titleBar_WindowAction(object sender, WindowActionEventArgs args)
        {
            rootDockPanel.flatten();
            if (args.Action == WindowAction.Undock)
            {
                var window   = new EditorWindow(this, args.DockableControls);
                var mousePos = PointToScreen(Mouse.GetPosition(this));
                if (args.Location != null)
                {
                    var location = args.Location.Value;
                    window.Left = mousePos.X - location.X;
                    window.Top  = mousePos.Y - location.Y;
                    window.Show();
                    window.StartDrag();
                }
                else
                {
                    window.Show();
                }
            }
            else if (args.Action == WindowAction.Minimize)
            {
                if (args.DockableControls == null)
                {
                    peekPanel.HideContent();
                }
                else
                {
                    peekPanel.Add(args.DockableControls, PeekSide.Left);
                }
            }
            else if (args.Action == WindowAction.Close)
            {
                if (peekPanel.IsOpen)
                {
                    peekPanel.ClosePeeked();
                }
            }

            args.Handled = true;
        }
Пример #3
0
 private void titleBar_WindowAction(object sender, WindowActionEventArgs args)
 {
     if (args.Action == WindowAction.Close)
     {
         if (args.DockableControls != null)      // close on a single tab
         {
             foreach (object item in Items)
             {
                 if (((item as EditorTab).Content as EditorPanel).Content == args.DockableControls.Panels[0].Control)
                 {
                     Items.Remove(item);
                     args.Handled = true;
                     return;
                 }
             }
         }
     }
     else if (args.Action == WindowAction.Undock)
     {
     }
 }
Пример #4
0
 private void titleBar_WindowAction(object sender, WindowActionEventArgs args)
 {
     if (!args.ActionHandled)
     {
         if (args.DockableControls == null)
         {
             var controls = new IDockablePanel[tabControl.Items.Count];
             for (int i = 0; i < tabControl.Items.Count; i++)
             {
                 var tab   = tabControl.Items[i] as EditorTab;
                 var panel = tab.Content as EditorPanel;
                 controls[i] = panel.Content as IDockablePanel;
             }
             args.DockableControls = new DockableGroup(controls, new Size(tabControl.ActualWidth, tabControl.ActualHeight));
             undockAll();
         }
         else
         {
             undock(args.DockableControls.Panels);
         }
         args.ActionHandled = true;
     }
 }