예제 #1
0
        private void DoClose()
        {
            if (IsKeyboardFocusWithin)
            {
                DockItem         dockItemToActivate = DockControl.ActiveItem;
                FrameworkElement focusedElement     = Keyboard.FocusedElement as FrameworkElement;
                if (focusedElement != null)
                {
                    DockItem item = focusedElement.DataContext as DockItem;
                    if (item != null)
                    {
                        dockItemToActivate = item;
                    }
                }
                if (dockItemToActivate != null)
                {
                    dockItemToActivate.Activate();
                }
            }

            if (_floatingWindowAdorner != null)
            {
                FloatingWindowAdorner.Remove(DockControl, _floatingWindowAdorner);
            }
            else
            {
                Window.GetWindow(this).Close();
            }
        }
예제 #2
0
 private void Show()
 {
     if (DockManager.GetFloatingWindowStrategy(DockControl) == FloatingWindowStrategy.Native)
     {
         Window window = new Window();
         window.WindowStyle           = WindowStyle.None;
         window.ResizeMode            = ResizeMode.NoResize;
         window.ShowInTaskbar         = false;
         window.SizeToContent         = SizeToContent.WidthAndHeight;
         window.Owner                 = Window.GetWindow(DockControl);
         window.AllowsTransparency    = true;
         window.Background            = null;
         window.Focusable             = false;
         window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
         window.Content               = this;
         window.Show();
     }
     else
     {
         Grid grid = new Grid();
         VerticalAlignment   = VerticalAlignment.Center;
         HorizontalAlignment = HorizontalAlignment.Center;
         grid.Children.Add(this);
         _floatingWindowAdorner = FloatingWindowAdorner.Add(DockControl, grid);
         UpdateLayout();
     }
     MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
 }
예제 #3
0
        public static FloatingWindowAdorner Add(DockControl dockControl, UIElement element)
        {
            AdornerLayer          adornerLayer = AdornerLayer.GetAdornerLayer(dockControl);
            FloatingWindowAdorner adorner      = new FloatingWindowAdorner(adornerLayer, element);

            adornerLayer.Add(adorner);
            return(adorner);
        }
예제 #4
0
        public static void Remove(DockControl dockControl, FloatingWindowAdorner adorner)
        {
            AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(dockControl);

            adornerLayer.Remove(adorner);
        }
예제 #5
0
 private void InitWpfStrategy()
 {
     _wpfFloatingWindowClient = new WpfFloatingWindowClient(_dockControl);
     FloatingWindowAdorner.Add(_dockControl, _wpfFloatingWindowClient);
 }